0

I have this code $(echo "psql -U postgres -d mydb -c "SELECT * FROM table_name;" " | ssh $REMOTE_IP)

I need to run that query in the remote host, but i can't apply the query part in the echo

Any help?

1 Answer 1

1

Your syntax is incorrect and you don't need to use pipe. Try this:

ssh "$REMOTE_IP" 'psql -U postgres -d mydb -c "SELECT *  FROM table_name;"'
Sign up to request clarification or add additional context in comments.

1 Comment

@PedroOsório Glad to see it works. Please consider upvoting/accepting the answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.