3

I get this error bash on my virtual hosting, in cron tasks. My command is following:

/usr/bin/mysqldump --user=USERNAME --password="C\(mRA0_ifmv\(" DATABASE > ROOTFOLDER/backup/$(date +%F).sql && gzip ROOTFOLDER/backup/$(date +%F).sql

I hid real user, database and home folder for security purposes. So, I understand that my password causes this error, but I don't want to change it.

How can I escape open bracket char or avoid this error and why "\" doesn't work?

1 Answers1

2

Use single quotes for the password.

--password='C\(mRA0_ifmv\('

Bash Manual: Single Quotes

Enclosing characters in single quotes (‘'’) preserves the literal value of each character within the quotes. A single quote may not occur between single quotes, even when preceded by a backslash.

Bash Manual: Double Quotes

Enclosing characters in double quotes (‘"’) preserves the literal value of all characters within the quotes, with the exception of ‘$’, ‘`’, ‘\’, and, when history expansion is enabled, ‘!’.

Steven
  • 28,386