Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Help on executing a bash script via shell()

I wish to run this script as sudo from BASIC

cat /home/neill/Documents/get_package_list_in_file.sh

!/bin/bash

dpkg -l > /home/neill/Documents/pkg.txt

dpkg -l > $1

neill@HDD-Mint-64:~$ echo "mypassword " | sudo -S /home/neill/Documents/get_package_list_in_file.sh /home/neill/Documents/pkg.txt [sudo] password for neill: neill@HDD-Mint-64:~$

click to hide/show revision 2
None

Help on executing a bash script via shell()

I wish to run this script as sudo from BASIC

cat /home/neill/Documents/get_package_list_in_file.sh

!/bin/bash

/home/neill/Documents/get_package_list_in_file.sh #!/bin/bash ## dpkg -l > /home/neill/Documents/pkg.txt

/home/neill/Documents/pkg.txt dpkg -l > $1

$1

neill@HDD-Mint-64:~$ echo "mypassword " | sudo -S /home/neill/Documents/get_package_list_in_file.sh /home/neill/Documents/pkg.txt [sudo] password for neill: neill@HDD-Mint-64:~$ neill@HDD-Mint-64:~$

Edit (Opaque): Put script text into preformatted text attribute for readability reasona. No changes to content.