I have written the script run.sh below for calling a java class :
java -cp . Main $1 $2 $3 $4
Here is my java class (it just displays the args) :
public class Main {
public static void main(String[] args) {
for (String arg : args) {
System.out.println(arg);
}
}
}
This is working unless I try to pass a parameter containing a space. For example :
./run.sh This is "a test"
will display :
This
is
a
test
How could I modify my shell script and/or change my parameter syntax to pass the parameter "a test" unmodified ?