1

I need to use a find command in a script with ssh and grep together. Something like this:

ssh user@host find /var/log -type f -mtime 1 -exec grep -i -F error warn {} \;

But it says, that there is no argument for -exec.

What should I do to fix this?

1 Answer 1

1

Put the commands inside quotes:

ssh user@host "find /var/log -type f -mtime 1 -exec grep -i -F error warn {} \;"

or

ssh user@host 'find /var/log -type f -mtime 1 -exec grep -i -F error warn {} \;'
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.