Reputation: 4515
I'm trying to download a file and run it using the following script:
wget https://github.com/glenpike/npm-g_nosudo/archive/master.zip
unzip master.zip
cd npm-g_nosudo-master
./npm-g-no-sudo.sh
cd ../
rm -rf npm-g_nosudo-master
rm master.zip
The downloaded script pauses twice requiring user input:
How can I include this input in the above script?
Upvotes: 0
Views: 69
Reputation: 326
In the bash script: https://github.com/glenpike/npm-g_nosudo/blob/master/npm-g-no-sudo.sh ,you can find
read -p "Do you wish to update your .bashrc/.zshrc file(s) with the paths and manpaths? [yn] " yn
on line 142, which means that you need to type something when you run this bash script.
So, one way to solve your problem is to fork this repo and modify it.
Upvotes: 1
Reputation: 11786
If the downloaded script is just reading from stdin, you can simply echo
or printf
the inputs:
echo -e "\ny\n" | ./npm-g-no-sudo.sh
Or:
printf "\ny\n" | ./npm-g-no-sudo.sh
Upvotes: 1