I have a program that REQUIRES a comment to be provided when the program is invoked. But 9 times out of 10 my comment is an empty string. The comment is specified using the '-c' switch on the program's command line.
ci -c "this izza comment" foo.bar
OK - now here's what I'd like to accomplish:
Basically, I'd like a front end script, call it cinew, that effectively makes the '-c' switch be optional. So, if I enter:
it invokes 'ci' as follows:
ci -c "" foo.bar
And, if I use '-c', such as:
cinew -c "unother test" foo.bar
it simply invokes 'ci' as is.
The biggest problem is that the quotes around -c's argument are lost once I'm inside the cinew script. So if I do this at the command line:
cinew -c "abc def" xyz
and my 'cinew' script contains a line:
it gets expanded to:
ci -c abc def xyz
which is interpretted as FOUR (not THREE) arguments by the 'ci' program.
There are additional (optional) switches supported by 'ci', so I can't just hard-code quotes into the script (for example, ci $1 "$2" $3), because I can't assume that $2 will always be the comment string.
I cannot figure out a simple way to preserve the quotes and pass them off to the 'ci' program within the shell script.
I tried 'set -f' before I ran 'cinew', but that didn't change anything.
My login shell is Bash, and the script is Bourne.
Thanks for any advice,
Why cant you quote every parameter?
ci "$1" "$2" "$3" "$4"
|All times are GMT -5. The time now is 03:47 PM.|