I am trying to figure out how to solve a problem with a "$" causing command expansion as part of a password field. How do you backslash the "$" when using command substitution (unknown) arguments? (i.e. $1, $2)
For example, in a script called 'testPass':
PASSWORD="$1"
echo $PASSWORD
If I type in:
testPass abcd123#$asd
Then the output is:
abcd123#
I have also tried single quotes (echo '$PASSWORD') as most people say online, however this just prints:
$PASSWORD
I have even tried using the printf command, which has also been mentioned online, as so:
printf '%q\n' '$PASSWORD'
However this does something similar, with the following output:
\$PASSWORD
I have searched for a long time to figure this out, however I am new to UNIX so I could be missing something I am unaware of. Please let me know if you have any ideas, thank you.