The shell on the local host is doing variable substitution on $NOW and $BACKUP because the “EOI” isn’t escaped. Replace
ssh [email protected] <<EOI
with
ssh [email protected] <<\EOI
More Related Contents:
- How do I tell if a regular file does not exist in Bash?
- How do I parse command line arguments in Bash?
- How do I split a string on a delimiter in Bash?
- Correct Bash and shell script variable capitalization
- While loop stops reading after the first line in Bash
- How do I compare two string variables in an ‘if’ statement in Bash? [duplicate]
- ssh breaks out of while-loop in bash [duplicate]
- How to urlencode data for curl command?
- Why equal to operator does not work if it is surrounded by space?
- How to run the sftp command with a password from Bash script?
- How to execute a bash command stored as a string with quotes and asterisk [duplicate]
- Find and Replace Inside a Text File from a Bash Command
- Random number from a range in a Bash Script
- Recursively rename files using find and sed
- How do I tell if a file does not exist in Bash?
- How can I set the current working directory to the directory of the script in Bash?
- Deleting lines from one file which are in another file
- Openssh Private Key to RSA Private Key
- How to enter ssh password using bash? [duplicate]
- How to create a bash script to check the SSH connection?
- How to use a bash script variable with sed [duplicate]
- access host’s ssh tunnel from docker container
- Passing a variable to a remote host in a bash script with ssh and EOF [duplicate]
- How to check the extension of a filename in a bash script?
- Extract version number from a string
- How to tell if a string is not defined in a Bash shell script
- find difference between two text files with one item per line [duplicate]
- Using a variable’s value as password for scp, ssh etc. instead of prompting for user input every time
- What does `kill -0 $pid` in a shell script do?
- How do I kill a backgrounded/detached ssh session?