I have a simple Python script that receives username and password as arguments, but my password contains two exclamation marks. When I call my script like
salafek@dellboy:~/Desktop/$ emailsender.py -u username -p pass!!
a command that I entered earlier replaces the exclamation marks:
salafek@dellboy:~/Desktop/$emailsender.py -u username -p "passemailsender.py -u username -p passwget wget http://www.crobot.com.hr/templog"
I can escape exclamation marks with backslash (\
), but my password changes.
Is there solution for this, how can I escape exclamation marks without changing my password?
Exclamation mark is for "Not" (like in boolean), -d flag is for folder exists in bash. It's not in the question by it may be worth mentioning for someone else reading this that && does short-circuit evaluation, so the condition to the left must be true for the condition to the right to be evaluated.
$@ refers to all of a shell script's command-line arguments. $1 , $2 , etc., refer to the first command-line argument, the second command-line argument, etc.
The exclamation mark is part of history expansion in bash. To use it you need it enclosed in single quotes (eg: 'http://example.org/!132' ). You might try to directly escape it with a backslash ( \ ) before the character (eg: "http://example.org/\!132" ).
You should be able to simply wrap things in single quotes in the shell.
$ emailsender.py -u username -p 'pass!!'
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