Issue in passing a parameter value from one script to another

Hi Experts,

I am passing current month & day (i.e. 'Jul 21') from script aaa.ksh to zzz.ksh. The value 'Mon DD' is being used in zzz.ksh.

Problem: If I pass 'Mon DD' value manually to zzz.ksh i.e.

/test/zzz.ksh 'Jul 21' 

it works fine. However, if I pass value from aaa.ksh, it does not.

In aaa.ksh, I am passing value following way:

l_day=$(date '+%b %d')

$JOBSDIR/zzz.ksh $l_day

In zzz.ksh, the value is being used following way:

LsFiles | grep "$@" | awk '{print $NF}' > list_of_files.txt

Note: LsFiles is a function.

If I call zzz.ksh from aaa.ksh it says:

grep: 21: No such file or directory

I put 'echo $@' to find the value and both way it returns Jun 21

Thanks in advance
Dip

Hi.

You quoted it when you calling it directly, but not from your script?

$JOBSDIR/zzz.ksh $l_day

(using double quotes...)

$JOBSDIR/zzz.ksh "$l_day"
1 Like

Thanks scott. It works now.