Visit Our UNIX and Linux User Community

Pass parameter to the main script from wrapper script

Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Pass parameter to the main script from wrapper script
# 1  
Old 02-11-2011
Pass parameter to the main script from wrapper script

I am writing a wrapper script( to one of the main scripts (
The main script is executed as following:

looks for a parameter which is a LIST(consists of different list names that need to be processed), START/END date.
I am able to calculate the start and end date but im not able to pass the LIST paramter to the
from the
So how do i pass LIST parameter from the wrapper script. This job will be scheduled in Control M.
with LIST as an argument.

This argument(LIST) should be passed as an argument to the

Here is the

#Capture the rundate whenever the script runs
echo "`date +%Y%m%d`" > lastrundate.txt
Today=`date +%Y%m%d`
Yest=`echo "$(date +%Y%m%d) - 1" | bc`
Filedate=$(cat lastrundate.txt)

#Check for today
if [ "$Filedate" = "$Today" ]; then
echo "Last rundate is today"

#Check for yesterday
elif [ "$Filedate" = "$Yest" ]; then
echo "last rundate is yesterday"

#Check for the date before yesterday
elif [ "$Filedate" != "$Today" ] && [ "$Filedate" != "$Yest" ]; then
echo "last rundate is $Filedate"
BEGINDATE=`cat lastrundate.txt | awk '{print $0 + 1}'`
fi <LIST> $ENDDATE $BEGINDATE > main_script.log 2>&1
if [ $? -ne 0 ]; then
echo "Not successful"
echo "Successful"

Any suggestions please!!!
Thanks in advance!

Last edited by pludi; 02-13-2011 at 05:51 PM..

Previous Thread | Next Thread
Test Your Knowledge in Computers #354
Difficulty: Medium
gawk is the only awk implementation that makes serious progress implementing internationalization and localization and TCP/IP networking.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Script Parameter Pass to Another Script

How do I pass a parameter from one script to another script? dbParam.ini pUser=Magic pPwd=Test1234 pNewPwd=HappyMeal #!/usr/bin/ksh . .dbParam.ini echo "user $pUser" echo "current password $pPwd" echo "new password $pNewPwd" when run (4 Replies)
Discussion started by: wtolentino
4 Replies

2. Shell Programming and Scripting

How pass the input parameter to a file in the script ?

OS version: RHEL 6.7 myTextFile.txt file is referred within script, I only execute and I want the input variable to be passed inside myTextFile.txt . Any idea how I can do this ? $ cat cat myTextFile.txt $ cat myTextFile.txt $1 Requirement1.... (4 Replies)
Discussion started by: kraljic
4 Replies

3. Shell Programming and Scripting

Pass script with parameter in korn shell script

I have written a script which will take input parameter as another script. However, if the script passed as input parameter has parameters then this script doesn't work. I have a script b.ksh which has 1 and 2 as parameters I have a script c.ksh which has 3,4 and 5 as parameters vi a.ksh... (1 Reply)
Discussion started by: Vee
1 Replies

4. Post Here to Contact Site Administrators and Moderators

Unable to pass shell script parameter value to awk command in side the same script

Variable I have in my shell script diff=$1$2.diff id=$2 new=new_$diff echo "My id is $1" echo "I want to sync for user account $id" ##awk command I am using is as below cat $diff | awk -F'~' ''$2 == "$id"' {print $0}' > $new I could see value of $id is not passing to the awk... (0 Replies)
Discussion started by: Ashunayak
0 Replies

5. UNIX for Advanced & Expert Users

How to use parameter in sql script pass from unix script?

Hi, I am unable to use parameter in sql script passed from unix script. my sql script CREATE_SBI_LIST_GROUP.sql is like this - ------------------------------- SELECT SDS.ID "SO_ID", SDS.SO a1, sgp.sga__code SGA_CODE, FROM sga sga,sales_genl_provision sgp , comm_product_condn cpc... (2 Replies)
Discussion started by: apskaushik
2 Replies

6. Shell Programming and Scripting

How to pass string as a parameter in a script

Hi friends. i am newbie to shell scripting. I need to create a script where i will be passing 2 parameters to the script and based on that it should work. For ex: start_proc a 2 or start_proc b 2 start_proc a 2 --- this should bring up 2 processes as i define inside the script. start_proc... (2 Replies)
Discussion started by: friscouser
2 Replies

7. Shell Programming and Scripting

Pass parameter into script

I would like to write a scirpt that it first checks the first parameter of the input. If it fulfill some condition ,then run an executable program b by using all the parameter. ie. > ./ 10 20 30 40 50 Then first checks the first parameter, 10, if it mathes the requirement, then... (2 Replies)
Discussion started by: alfredo
2 Replies

8. Shell Programming and Scripting

how can i pass parameter with spaces to csh script

Hello all i need to pass to my shell script parameter that looks like "2 3 3" inside the script i need to use this string that looks like this "2 3 3" but when i try to print the script im getting syntax error , this is my script : set s = $1 echo $s (1 Reply)
Discussion started by: umen
1 Replies

9. UNIX for Dummies Questions & Answers

How to pass two or more parameters to the main in shell script

Hey Guys from the below script what I understood is we are sending the the first parameter as input to the main (){} file main > $LOGFILE 2>&1 but can we send two or three parameter as input to this main file as main > $LOGFILE 2>&1 2>&2 like this Can any one plz help I need to writ a... (0 Replies)
Discussion started by: pinky
0 Replies

10. UNIX for Dummies Questions & Answers

Pass Parameter to Another Script

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: ....... nohup ./Script2 PARAMETER ....... Script2: if # Checks if any params. then echo "No parameters passed to function." ... (4 Replies)
Discussion started by: rvprod
4 Replies

Featured Tech Videos