![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Pass parameter into script | alfredo | Shell Programming and Scripting | 2 | 04-08-2008 06:40 PM |
| how can i pass parameter with spaces to csh script | umen | Shell Programming and Scripting | 1 | 03-19-2008 08:33 AM |
| How to pass a parameter from one Shell-script to another Shell-script | subodhbansal | Shell Programming and Scripting | 2 | 09-22-2007 02:19 AM |
| PASS parameter to AWK | unisam | UNIX for Dummies Questions & Answers | 2 | 05-14-2004 06:51 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
I have a piece of code that I do not want to continuously repeat. I want to call script2 from script1 and pass a parameter. Here is an example:
Script1: Code:
....... nohup ./Script2 PARAMETER ....... Code:
if [ -z $1 ]
# Checks if any params.
then
echo "No parameters passed to function."
return 0
else
PARAM = $1
ftp -vn xxx.xxx.xxx.xxx <<- eof
user pswd
bin
mput *
bye
eof
fi
fi
Last edited by oombera; 02-18-2004 at 12:57 PM. |
| Forum Sponsor | ||
|
|
|
|||
|
Not 100% sure what you're asking here...but if It's what I think it is....
Run script 1 like this...... ./Script1 Hello In Script 1 - you have nohup ./Script2 $1 Then script 2 is the same. Why you would want 2 scripts here I'm not sure (but thismay just be for the example?) If this really is your script - then you could just use nohup ./Script2 Hello Because all you are doing is running script2 in nohup and passing it the same variable. Up to you! (Not sure what you are actually doing with the variable though?)
__________________
Pete |
|
|||
|
Script1 is invoked by process. It is not manual. When this process makes Script1 run I want it to pass a parameter to Script2. There is more code in Script1 than what I am showing. I want Script2 to contain code outside of Script1 because there are 13 other scripts that use the code in Script2. I do not want to have to maintain the code in 13 scripts.
The code inside Script1 is: Code:
.............. .............. nohup ./Script2 $ARE .............. .............. Code:
if [ -z $1 ]
# Checks if any params.
then
echo "No parameters passed to function."
return 0
else
PARAM = $1
if [ ! -r $INDIR/$PARAM/* ]
then
#NO FILE IN THE IN DIRECTORY
else
ftp -vn xxx.xxx.xxx.xxx <<- eof
user pswd
bin
mput *
bye
eof
fi
fi
Last edited by oombera; 02-18-2004 at 12:58 PM. |