LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Passing parameters to bash script (https://www.linuxquestions.org/questions/programming-9/passing-parameters-to-bash-script-368578/)

Kamikazee 09-30-2005 06:02 PM

Passing parameters to bash script
 
Ive set up the following ftp script. (called FTP)

Code:

#!/bin/sh
HOST='MyHost'
USER='MyUser'
PASSWD='MyPassword'
FILE= $1

ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
put $FILE
quit
END_SCRIPT
exit 0

however, when i run it with - ./FTP screen.jpg
the screen.jpg file is in the working directory at the time but it outputs

./FTP: line 5: Screen1.jpg: command not found
(local-file) (remote-file)


Any ideas?

Thinking 09-30-2005 06:08 PM

i'm not sure but try this one

./FTP ./screen.jpg

greetz

Dark_Helmet 09-30-2005 06:28 PM

Code:

FILE= $1
Bash is very particular about spaces. Give it a shot without the space between the '=' and '$'

Kamikazee 09-30-2005 06:46 PM

Thanks Dark_Helmet. You were spot on.

bigearsbilly 10-01-2005 06:41 AM

you can use $HOME/.netrc file to automate ftp transactions

man netrc


All times are GMT -5. The time now is 07:22 AM.