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!
80 bytes transferred

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/


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.

  • so that is how that worked, thx for the help – nwgat 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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