Reputation: 147
I am using picocli as a utility to encrypt a given password. In my CLI, I have the option to pass the password String, and a key file. The key file will be used to encrypt the password string.
When the password string is containing a dollar ($) sign, picocli is ignoring it.
For example,
java -jar encryption.jar passwd-enc -password "test23$34" -key /user/local/key.txt.
The password parsed by java is "test234" instead of "test23$34".
How can I solve this?
Upvotes: -1
Views: 43
Reputation: 1503140
This looks like it's almost certainly a matter of your shell's handling of the command line argument rather than anything to do with Java or picocli. You can validate that by just echoing the command line argument:
$ echo "test23$34"
test234
Assuming something like bash, either use single quotes around the password to prevent variable substitution: 'test23$34'
or escape the dollar with a backslash: "test23\$34"
.
Upvotes: 1