Quote and variable

The command line bellow works fine by itself.

/opt/csw/bin/rsync -azq --delete -e "ssh -i /.ssh/ss" /home/ me@myaccount.storage.com:/home/

Now I would like to introduce some variable into it and make a .sh file such as bellow and it does not work anymore. I guess the part -e "ssh -i /.ssh/ss" has syntax error but I don't know what to do. Any hint appreciated.

#!/bin/sh
DIR=/home/
/opt/csw/bin/rsync -azq --delete -e "ssh -i /.ssh/ss" "$DIR" me@myaccount.storage.com:"$DIR"

Have you tried use ${DIR} instead of "$DIR" ?

Why would that make any difference?

Are you sure this is correct? "ssh -i /.ssh/ss"

That implies you are using a directory named .ssh in the root ( / ), not your home directory.

If you are using the standard SSH configuration subdirectory in your home directory, then drop the extra slash (or add a tilde ( ~ ):
"ssh -i .ssh/ss"

Well I was not sure but I assumed that problem is caused by variables. So if only sh would not understand quotation mark this notation could help.

But as I mentioned it was just shot.

ngungo

Try to launch your script with "sh -x" and "ssh -vv". Maybe it will show anything valuable.