Embedded quotes in shell command. HELP!!

sergei.sheinin_at_db.com
Date: 09/13/05


Date: 13 Sep 2005 07:40:20 -0700

Hello, All!

I'm having a problem where a Perl script needs to launch a command in
the following format (which doesn't work now):

ssh appserv1 -l appadmin 'find /app2/files/*.txt-* -mtime -1 | grep -v
'Z$' | cut -d . -f 1'

As you can see, what this command does is logs on to server appserv1,
pulls *.txt* files from directory /app2/files/ that are not older than
one day, filters the results with grep command so that entries for
files ending with letter Z are not retrieved, and uses cut command to
remove file extensions.

My problem is with nested single-quotes, as the grep command requires
the pattern to be single-quoted. But in this case the entire command
following ssh appserv1 -l appadmin must be single quoted as well (or am
I missing something?).

Is there a way to escape the inner single quotes in this command, cuz
otherwise I'll have to write a separate Perl routine for filtering the
entries ending with letter Z, in which case I can remove the grep
command from the statement.

Thanks for your help,
Endorphin.



Relevant Pages

  • Re: Embedded quotes in shell command. HELP!!
    ... > I'm having a problem where a Perl script needs to launch a command in ... > Is there a way to escape the inner single quotes in this command, ... script with ssh. ...
    (comp.unix.shell)
  • Re: "FIND" command
    ... The second condition matches. ... terminating semi-colon has meaning to the shell and must be escaped. ... I did just try the command above. ... It still matches files ending in BAT ...
    (comp.os.linux.misc)
  • Re: makefiles for Java projects HOWTO?
    ... the `xxx` command line argument enclosed in reverse ... I haven't found a good equivalent in Windows. ... which writes a list of all files ending in .java contained in the ... and that, of course, lists all the occurrences of "Schmoo" in those ...
    (comp.lang.java.softwaretools)
  • Re: Problem using command line argument with grep in plot file
    ... the construction of the grep command is correct, ... If I remove the grep command and just try to plot everything, ... Here's the full plot file. ... set term png size 800,400 enhanced font 'Verdana,10' ...
    (comp.graphics.apps.gnuplot)
  • Re: head behaviour
    ... PID TT STAT TIME COMMAND ... the grep command. ...
    (freebsd-hackers)