I am using SSH command to execute the bash scripts remotely:
ssh user@server 'bash -s' < $script_dir/script.sh
And inside the script.sh, I will have the command like below to add ssh keys:
ssh-keygen -t rsa ssh-copy-id postgres@$sqlserver ssh postgres@$sqlserver -C true
And also create user in remote sql server
printf "Creating user in postgresql server...\n" createuser -s -P username
Which need user's input, but I found when I execute the command from the remote server, it will skip getting the users' input and failed.
Another one is:
printf "Please enter your barman server name: \n" ; read -s barmanserver
Which cannot read user's input neither
I know that the script seems cannot read the other terminal's input, but can anyone help me find a solution if I need the user input to continue?
Thanks a lot!!