I need to pass cmd parameters to my bash script, but it keeps on stripping out the quotes.
Below is an example. In my script, I add some additional processing where I add data to my first variable before I process the command
$> ./test.sh -t some.comman -extraswitch "some addtional info"
The script uses Java to do some processing, but the "some additional info" is missing the quotes and thus can't execute the Java portion of this script. How can I preserve the quotes from the command line so that I can execute my Java command in my script?
Java command in script
java $JAVA_OPTS "$@"
Output
java lib -someoption -anotheroption -javalibswitch some additional info
Intended Output
java lib -someoption -anotheroption -javalibswitch "some additional info"
$> ./test.sh -t some.comman -extraswitch '"some addtional info"'
should do it – Marvismarwin"$@"
will properly pass the arguments to java. In what way is your java program failing to handle its arguments? – Pros"\"stuff\""
– Deboradeborahjava
command line you claim doesn't work, I think your problem is withJAVA_OPTS
, no$@
. – Perez