Answer the question
In order to leave comments, you need to log in
How to connect to Heroku from bash script?
I need to connect to the database inside Heroku in a bash script:
heroku pg:psql postgresql-db --app myApp
And then execute certain queries.
But if I paste this command into a bash script, then only the connection occurs, and until I log out of Heroku, the rest of the bash script will not work.
How can I connect from a bash script to Heroku-postgresql and run multiple commands?
Answer the question
In order to leave comments, you need to log in
Here is an example for an FTP client:
ftp -i -n сервер <<END
user юзер пароль
cd директория
get файл
mget список_файлов
END
In this variant, you can use inside $переменная
, ${переменная}
, `команда`
, $(команда)
. And the special characters used, if they need to be entered as they are, you need to backslash; well, the backslash itself also needs to be backslashed. ftp -i -n сервер <<\END
, then all special characters cease to be special, you don’t need to backslash anything. Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question