Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i have a bash script i would like modify to support input from shell atm i have to type the link after i have run the script

wiak@test:~$ scripts/lget.sh
gimme cookie!
https://raw.github.com/nwgat/scripts/master/lget.sh
80 bytes transferred
done.
wiak@test:~$

like this input from shell

lget https://github.com/nwgat/scripts/raw/master/lftp.sh

the bash script

echo "gimme cookie!"
read down
lftp -e 'pget -n 5 '$down' && exit'
echo "done."

its also here on github if someone wants to fork it https://github.com/nwgat/scripts/blob/master/lget.sh

software needed to make it work: lftp http://lftp.yar.ru/

share|improve this question
up vote 1 down vote accepted

Try this:

echo "gimme cookie!"
#read down
lftp -e 'pget -n 5 '$1' && exit'
echo "done."

Now you can pass the link as a command line option. $1 expands to the first command line option you pass to your shell script.

share|improve this answer
    
so that is how that worked, thx for the help – wiak Mar 9 '14 at 22:17
    
Yes :) You're most welcome. I am glad to have been of help. – Ghassan Mar 9 '14 at 22:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .