Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Escape quote in extra args

Edited

Hi folks,

I'm trying to use the parameter --rsync-path='sudo rsync' in the EXTRA_ARGS field. But I get caught with strange escapings. I tried escaping the single quote with '' (two single quotes). I tried double quotes within the single quoted string. Nothing works. What's wrong?

e.g.

 - pipe: atlassian/rsync-deploy:0.2.0
variables:
USER: 'bitbucket'
SERVER: 'fe01.mydomain.de'
REMOTE_PATH: '/var/www/public/sandbox'
LOCAL_PATH: '.'
DEBUG: 'true'
EXTRA_ARGS: '-rzhv --delete --stats --rsync-path="sudo rsync" --exclude=/sandbox/ --exclude=/sandbox2/ --exclude=/test/ --exclude=/vanilla/ --exclude=/var/ --exclude=/web/ --exclude=/files/ --exclude=/media/ --exclude=/config.php --exclude=*.dist --exclude=/.git/ --exclude=/.bitbucket/'

 Ends in

+ run rsync -rp --delete-after -rzhv --delete --stats '--rsync-path="sudo' 'rsync"' --exclude=/sandbox/ --exclude=/sandbox2/ --exclude=/test/ --exclude=/vanilla/ --exclude=/var/ --exclude=/web/ --exclude=/files/ --exclude=/media/ --exclude=/config.php '--exclude=*.dist' --exclude=/.git/ --exclude=/.bitbucket/ . xxx@xxxx.de:/var/www/public/sandboxINFO: Starting RSYNC deployment to xxx.de:/var/www/public/sandbox...+ echo rsync -rp --delete-after -rzhv --delete --stats '--rsync-path="sudo' 'rsync"' --exclude=/sandbox/ --exclude=/sandbox2/ --exclude=/test/ --exclude=/vanilla/ --exclude=/var/ --exclude=/web/ --exclude=/files/ --exclude=/media/ --exclude=/config.php '--exclude=*.dist' --exclude=/.git/ --exclude=/.bitbucket/ . xxx@fxxx.de:/var/www/public/sandbox+ set +ersync -rp --delete-after -rzhv --delete --stats --rsync-path="sudo rsync" --exclude=/sandbox/ --exclude=/sandbox2/ --exclude=/test/ --exclude=/vanilla/ --exclude=/var/ --exclude=/web/ --exclude=/files/ --exclude=/media/ --exclude=/config.php --exclude=*.dist --exclude=/.git/ --exclude=/.bitbucket/ . xxxx@xxxx.de:/var/www/public/sandbox++ rsync -rp --delete-after -rzhv --delete --stats '--rsync-path="sudo' 'rsync"' --exclude=/sandbox/ --exclude=/sandbox2/ --exclude=/test/ --exclude=/vanilla/ --exclude=/var/ --exclude=/web/ --exclude=/files/ --exclude=/media/ --exclude=/config.php '--exclude=*.dist' --exclude=/.git/ --exclude=/.bitbucket/ . xxx@xxxx.de:/var/www/public/sandbox+ output='Warning: Permanently added the RSA host key for IP address '\''xx.99.xxx.89'\'' to the list of known hosts.bash: -c: line 0: unexpected EOF while looking for matching `"'\''bash: -c: line 1: syntax error: unexpected end of file

 

2 answers

1 accepted

0 votes
Answer accepted

Hi @Arne Becker . The problem is that pipe treats the command as a list of separate tokens, so 

'--rsync-path="sudo' 'rsync"'

becomes two separate strings. We'll try to figure out how to avoid this problem.

That would be great. I'll try the vanilla rsync command, meanwhile.

@Alexander Zhukov Did you figure it out? This is not answered

 

@Alexander Zhukov  we are facing the same issue. Any updates on this issue?

image: atlassian/default-image:latest
pipelines
:  
default:      
step:          
name'Deployment to dev'          
deploymentdevelopment          
script:            
rsync -rp --verbose --delete-after --rsync-path='sudo rsync' $BITBUCKET_CLONE_DIR/ ${USER}@${REMOTE_SERVER}:${REMOTE_PATH}

 @Roman Szymański that's working for me.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Trello

Taco Tuesday: Your favorite Trello blog takeaway

Hello friends! From the community that brought you Welcome Wednesday, Throwback Thursday and Friday Fun, welcome to Taco Tuesday, a weekly discussion about all things Trello. The best part? One Tac...

87 views 7 6
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you