So, I am attempting to execute the following from within a shell script;ssh -q $CUR_HOST cd $LOGS_DIR; echo cd $LOGS_DIR; find . -name *.log -mmin +1440 -exec gzip {} \; exitWhen this runs, it generates the following error;find: paths must precede expressionUsage: find [-H] [-L] [-P] [path...] [expression]I've tried numerous variations based on things found on Google, but none seem to resolve this problem. Could anyone tell me what is wrong with this?As a side note, when I manually login to the target host and run the same find command there, it works just fine. So, I'm led to think that it's something to do with the command being embedded in the double quotes of the ssh command.
Using exec in find over ssh from shell script
bash;shell script;ssh;find;quoting
You forgot to add an ';':ssh -q $CUR_HOST cd $LOGS_DIR; echo cd $LOGS_DIR; find . -name *.log -mmin +1440 -exec gzip {} \;; exitBecause of the missing ;, find interprets exit as a path.