fabrix_00
fabrix_00

Reputation: 163

print password with special character in bash script

I need to print this password in script :

PASS="$database$"
echo "sqlcmd  -U system -P $PASS -S dbtest ">> exec.bat

but when I execute the script, I have thi result:

echo "sqlcmd  -U system -P **$** -S dbtest ">> exec.bat

Can you help me?

Upvotes: 0

Views: 94

Answers (1)

Tom Fenech
Tom Fenech

Reputation: 74635

You need to use single quotes in the assignment:

PASS='$database$'

Currently, $database is being interpreted as the value of a variable, because of the double quotes.

Upvotes: 1

Related Questions