1846594 Members
2431 Online
110256 Solutions
New Discussion

Re: Add parameter

 
haeman
Frequent Advisor

Add parameter

I have a ftp script "script1" like this

#vi script1
ftp ip <lcd dir1
cd dir2
put ${1}
! script2
bye
EOF


then I run it as
#script1 myfile

then it could ftp myfile to remote site , it works fine , that mean ${1} is the parameter

In the script1 , it will run another script ( script2) , now I would like this scripts also use the parameter , for example , I would like to display the parameter of ${1} like below , what can i do ?

I tried to edit script2 as below
#vi script2
echo ${1}

what I expect the result is myfile , but it didn't , can advise what can i do ? thx
2 REPLIES 2
Ollie Rowland
Frequent Advisor

Re: Add parameter

Hi,

You need to pass the $1 to the script you're trying to run.

The $1, $2, etc are the arguments to the script.

So, if you change your script to use
! script ${1}
instead of
! script
it should work.
haeman
Frequent Advisor

Re: Add parameter

thx all