I have written a command line script and I am testing that using java
.
In command line I write like this: script -html="anchor bold"
so while testing the same using java code, how exactly should my string be outlined?
-html=anchor bold"
it doesn't work as double quotes dont get included so my test fails
-html=\"anchor bold\"
this escapes double quotes but I want it.
-html=\\\"anchor bold\\\"
this results in -html=\"anchor bold\"
but I don't want any slashes.
I am using a String[]
array to execute the command.
new String[] { "--path=" + p,
"--user=" + user,
"--html=\"anchor bold\"",
"--port=8081"
}
The command line argument is:
path/executeScript --path=path1 --user=testUser --html="anchor bold" --port=8081