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

 

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket Pipelines

What We Learned When We Researched Open Source Vulnerabilities in 7 Popular Coding Languages

...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...

1,055 views 0 3
Read article

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