Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

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 {} \;'
share|improve this answer
    
Thanks! This worked like a charm! –  Airee Apr 11 '13 at 2:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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