Rsync command variable, bash script -


rsync="rsync -avzhe 'ssh -i /path/to/deploy_keys/id_rsa' --delete "  # files $rsync deploy@ip:/var/www/path1 /var/www/path1 $rsync deploy@ip:/var/www/path2 /var/www/path2 

i'd introduce rsync variable more compact, throws error:

unexpected remote arg: deploy@ip:/var/www/path1 

if use rsync inside doublequotes, works fine. sake of readability, i'd keep them separate command invocations.

i agree eval dangerous. in addition array approach @eugeniu rosca suggested, use shell function:

my_rsync() {     rsync -avzhe 'ssh -i /path/to/deploy_keys/id_rsa' --delete "$@" }  my_rsync deploy@ip:/var/www/path1 /var/www/path1 my_rsync deploy@ip:/var/www/path2 /var/www/path2 

btw, should read bashfaq #50: i'm trying put command in variable, complex cases fail!.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -