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

using find with -exec in a pipeline fails

Jan Hüffelmann July 16, 2019

i cannot get the following running thru the pipe, its working on the target's cli though:

- ssh $HOST find $SOMEDIR -exec mv {} $OTHER_DIR \;

it complains about 'missing an argument to -exec'

tried every imaginable quoting - no idea anymore - do you?

1 answer

1 accepted

1 vote
Answer accepted
Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 16, 2019

Hello @Jan Hüffelmann,

Well, this wouldn't work on any box, not just Pipelines:

❯ ssh test@tower find . -name ".*profile" -exec file {} \;
find: missing argument to `-exec'

A complex command has to be quoted when passed to ssh. This works fine:

❯ ssh test@tower 'find . -name ".*profile" -exec file {} \;'
./.bash_profile: ASCII text

Hope this helps.

Cheers,
Daniil 

Jan Hüffelmann July 18, 2019

i tried that one too - unfortunately not working - thanks

Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 18, 2019

So here's an exact command that works for me:

pipelines:
default:
- step:
script:
- ssh -p 10080 -l www -oStrictHostKeyChecking=no 0.tcp.au.ngrok.io 'find . -name ".*history" -exec cat {} \;'

Here's a screenshot of a successful pipeline for that config (last line ls -la is the content of .ash_history file located on the remote server ssh connects to):

 Pipelines — Bitbucket 2019-07-18 20-19-12.png

I was testing against a locally running Docker image panubo/sshd, which is based on Alpine Linux, through ngrok — hence such target hostname in the config.

So I'm wondering maybe the issue you're facing is with the target host? Otherwise please double check the actual ssh command you're calling.

Please let me know if this helps.

Cheers,
Daniil

Jan Hüffelmann July 19, 2019

sorry, must be ive messed someting up testing back and forth, now its working single quoted as you mentioned, ty

Like Daniil Penkin likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events