Quantcast
Channel: bash: how to pass password containing special characters - Stack Overflow
Viewing all articles
Browse latest Browse all 2

bash: how to pass password containing special characters

$
0
0

I have a bash script to download data from a website. For this I need to pass the username and password using a java client for the website. My password has a special character that is causing problems. I have tried the usual solutions but none are working.

#!/bin/sh#$ -cwdMYPASSWORD='password&123'java -jar client.jar -p username $MYPASSWORD file.gz

Tried using \ either directly in the command or using the variable. But that didnt work. Login failed!

MYPASSWORD=password\&123java -jar client.jar -p username $MYPASSWORD file.gz

Tried "" or ''. Login failure.

MYPASSWORD='password&123'java -jar client.jar -p username "\"$MYPASSWORD\"" file.gz

Also tried it, no luck. MYPASSWORD='password'"&"'123'

Any suggestions would be most helpful. Resetting the password on this website also seems problematic.


Viewing all articles
Browse latest Browse all 2

Trending Articles





<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>