0

Usually when password contains special character if we provide it inside single quote, it works while doing mongo operations. But if it has single quote or double its causing below issue

Below is mongodump command with password containing singlequote and doublequote

sudo docker exec -t container_name mongodump --db db_name --authenticationDatabase admin -u=username -p='f'%`Z(Ov"{Z(i' -o=/data/db/backup/mongodump_sample --gzip

password in above is f'%`Z(Ov"{Z(i

It gives below error:

b'/bin/sh: 1: Syntax error: EOF in backquote substitution\n'

How to fix the issue ?

Neo
  • 5,070
  • 10
  • 46
  • 65
  • 2
    Note that the error came from `/bin/sh`. This is a problem with shell escaping, not with mongodb. – Joe Sep 25 '21 at 18:50
  • Does this answer your question? [Escape backquote in a double-quoted string in shell](https://stackoverflow.com/questions/1824160/escape-backquote-in-a-double-quoted-string-in-shell) – Joe Sep 25 '21 at 18:50
  • No, i tried escaping, but it didnt worked – Neo Sep 28 '21 at 17:48
  • In that command line, the backquote is not inside of a quoted expression. Try surrounding the entire password with double quote, and escaping the backquote and the contained double quote – Joe Sep 30 '21 at 06:42

0 Answers0