Ranchers, When I execute the java program (described in a shell)in linux machine with white-space contained argument, the prgram received more arguments than expect, but I have already enclose the argument using double quote.
I use the command like this
deploy.sh "argu ment 1".
but the program prompt it receive 3 argument than 1.
date >> ../../logs/cif_deployment.out date >> ../../logs/cif_deployment.err
The problem is caused by the shell script stripped off your double quote. To make it work you have to put the double quote inside your script when calling the java class.
The weakness of above script is it will wrapped all your arguments into one, or you can code it like before
If you are VERY SURE there will always be 3 arguments, because is you do not pass enough arguments..the double quotes in the above script will pass empty string to your java program as argument...so your java program will always have 3 arguments.
I hope that make sense.
Joined: Jul 20, 2004
great, thx very much.
It is really a hard time for me to work on linux.
subject: Execute shell with space-contained arg in Linux