Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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 at 22:17
    
Yes :) You're most welcome. I am glad to have been of help. –  Ghassan Mar 9 at 22:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.