The following is a part of my script where I want to echo some text to the local terminal if the condition fails in ssh.
/usr/bin/sshpass -p $PASSWORD /usr/bin/ssh -t -o "StrictHostKeyChecking no" root@$IP -p $PORT '
cd $PATH;
[ ! -d temp ] && mkdir temp;
for new_file in '${NEW_FILE[@]}'
do
[ -f $new_file ] && mv -f $new_file temp/$new_file-'$DATE'
DOWNLOAD=$(wget --no-check-certificate '$URL'/$new_file > /dev/null 2>&1)
if [ '$?' -ne '0' ]; then
mv temp/$new_file-'$DATE' '$PATH'/$new_file
echo "$new_file download failed! please check and re-run the script"
else
chmod +x $new_file
fi
done;'
except echo remaining functionality works well ...
Let me know is it possible to echo from ssh to local terminal.