One of the arguments passed to my java program is like this, ab|cd
. Initially, when I run the java program, like this,
$ java className ab|cd
it fails, since |
is interpreted in the linux shell as a pipe symbol. So only ab
is passed into java program. So I made a second attempt:
$ java className "ab|cd"
This time, "ab|cd"
is passed in, but the value includes the double quotes. What the program is really intended to have is ab|cd
. How can I pass in the correct value without the quotes?
In the command shell, you can escape out characters using the '\' character.
java className ab\|cd
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With