Select Command not working while run shell scripts on remote machine

If you tell bash to read commands from stdin, which is what the -s option does, and then redirect its stdin, you cannot provide input via stdin any longer.

You should it as a normal script:

ssh [email protected] bash /root/BackupShellScript/remote.sh

And source /usr/local/etc/BackupShellScript/configuration.conf from your script, instead of hacking your way around with cat and process substitution.


That script doesn't work even locally - never mind with ssh.

The problem is just that you put your result into option and then use case $opt. So change option to opt and all is well.

#!/bin/bash

restore (){
        echo "Restore"
}

deploy () {
        echo "Deploy"
}

echo "Select any option to proceed..."
select opt in "deploy" "restore" ; do
case $opt in

        restore)
        restore;
        break;;

        deploy)
        deploy;
        break;;
esac
done