0

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:

  1. an 'enter' key press
  2. an 'y' followed by an 'enter'

How can I include this input in the above script?

2 Answers 2

1

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
Sign up to request clarification or add additional context in comments.

Comments

1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.