All,
I have a cron job script that receives several command line arguments. At some point if there are validation problems and the job cannot be run, it duplicates the entire command line into a temporary text file which is later executed as a script. Unfortunately when I pass the list of received arguments (ie: $*) to this new file, the quoted blank arguments are dismissed.
For example, my script "runbatch.sh" looks like this:
#!/bin/ksh #runbatch.sh
if [ some validation fails ]
then
echo "$0 $*" >> retryjobs.sh
exit 1
fi
If runbatch.sh was run as:
runbatch.sh one two '' four five
It will convert the 2 single quotes to a blank when exporting the line to retryjobs.sh, thus removing the blank argument.
Here's what retryjobs.sh looks like:
runbatch.sh one two four five
I need those single quotes to be passed. Any ideas anyone??
Thanks for the tip - I never tried man on ksh - kool
Unfortunately either "$@" or "$*" produce an unquoted double space
How about trying to replace this double space with [space]
[quote]
[quote]
[space]. The 'tr' command doesn't seem quite fit to handle this. Remains 'sed' but I am not very familliar with it. Please help with the correct syntax: