Error running pg_dump on git bash: too many command-line arguments

Asked 2 years ago, Updated 2 years ago, 97 views

I did the following on the git bash I installed on Windows 10.
There will be no response.

pg_dump-c-Uxxxx-h xxxx.rds.amazonaws.com-f "C:\Users\xxxx.sql"

When I ran the same command at the command prompt, they asked me for my password and I was able to execute it successfully.
Gitbash does not ask for a password and does not respond.

Do you have any settings?

I would like to use git bash because I would like to run the command in the sh script in the end.

I would appreciate it if you could point it out.

addition:

It was not that there was no response, but the following error was actually displayed:
Sorry for the incorrect information.

 pg_dump: error: too many command-line arguments (first is "-f")

postgresql git-bash

2022-09-30 19:20

1 Answers

The entered string is interpreted by rules per shell and the process is started.Same

pg_dump-c-Uxxxx-h xxxx.rds.amazonaws.com-f "C:\Users\xxxx.sql"

Even if you enter , the git bash (bash) and the command prompt (cmd.exe) have different interpretations.

  • bash
    • " is interpreted as a quart string.Removed after interpretation.
    • \ is interpreted as an escape sequence.Any \ that does not fall under the escape sequence is removed.
    • Arguments passed to
    • pg_dump are similar to -c-Uxxxx-h xxxx.rds.amazonaws.com-f C:Usersxxxx.sql (depending on the character after \).
  • cmd.exe
    • " is interpreted as a quart string.It will remain after interpretation.
    • \ is interpreted as a normal string and is not specifically translated.
    • Arguments passed to
    • pg_dump are -c-Uxxxx-h xxxx.rds.amazonaws.com-f "C:\Users\xxxx.sql".
  • " is interpreted as a quart string.Removed after interpretation.
  • \ is interpreted as an escape sequence.Any \ that does not fall under the escape sequence is removed.
  • Arguments passed to
  • pg_dump are similar to -c-Uxxxx-h xxxx.rds.amazonaws.com-f C:Usersxxxx.sql (depending on the character after \).
  • " is interpreted as a quart string.It will remain after interpretation.
  • \ is interpreted as a normal string and is not specifically translated.
  • Arguments passed to
  • pg_dump are -c-Uxxxx-h xxxx.rds.amazonaws.com-f "C:\Users\xxxx.sql".

pg_dump booted from bash did not receive the correct filename in -f, so it is not clear what to do if you connect to the server, and the connection process is not progressing.Isn't that why you don't ask for your password?

bash to have the same result as cmd.exe

pg_dump-c-Uxxxx-h xxxx.rds.amazonaws.com-f "\"C:\\Users\\xxxx.sql\""

and so on.

pg_dump does not require " or recognizes / as directory separated

pg_dump-c-Uxxxx-h xxxx.rds.amazonaws.com-f "C:/Users/xxxx.sql"

But it might work.This area is program dependent and cannot be said for certain.


2022-09-30 19:20

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.