Skip to content
Advertisement

Why I get an error when I try to execute a command remotely?

I have a problem about execute command remotely via SSH. I am trying below.

JavaScript

It gives an error like:

JavaScript

Advertisement

Answer

The problem is that you’re using double quotes to delimit the argument to ssh and also the argument to psql inside the command. This is causing your strings to be parsed incorrectly. You’re also missing the ending double quote for the psql command.

Nesting quotes is tricky in shell, and it’s even harder when you’re using ssh. It’s easier if you use a here-doc.

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement