Execute sequential commands using a script through gotty-client
kunal-pandit opened this issue · 2 comments
I want to execute a setup script which contains sql commands like creating a role, assigning privileges to a user etc..
gotty-client does have a command parameter but the documentation is not clear on how we can use it to execute sql scripts on the command line.
gotty-client [global options] command [command options] GOTTY_URL
Is this possible with the current gotty-client, if yes could someone point me to the documentation.
Thanks.
Hi @kunal-pandit, gotty-client
does not have any kind of command intelligence, it's basically a local TTY
bound to a websocket
, it doesn't care if the remote gotty
server runs a shell, a tmux
, or something without prompt, i.e.: emacs
, vim
I suggest you give a look at pexpect
, it's a small utility available in basically every language, it allows you to script a tty to automate actions based on triggers, you can easily tell to your program to run a command when it detects a shell prompt
Thanks @moul for clearing this up. I will look into pexpect
.