I want to run my shell script on a remote machine and I need user want to give value for some variable for that we use Read command while run script on local machine but I use the same command while run the script on remote machine but it's not working for me. How to use Read command for run script on remote machine?
sample code :
restore (){
echo "Restore"
}
deploy () {
echo "Deploy"
}
echo "Select any option to proceed..."
read opt
case $opt in
restore)
restore;
break;;
deploy)
deploy;
break;;
esac
This code work fine for when run scripts on local machine.
Thanks in advance !
cat FILES... | ssh [...]
. If you only have one file to redirect, you don't even needcat
and a pipe. Just redirect the file directly to the target process:ssh [...] < FILE
. (See muru's answer for a reason, why neither work here.)