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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .