[TriLUG] bash cmd line processing question

M. Mueller (bhu5nji) bhu5nji at yahoo.com
Thu Feb 14 14:05:27 EST 2002


Thank you all.  That helps a lot.  I can't find this topic covered in 
"Learning the bash Shell" 2nd Ed.  Looked under Symbols in index - nothing.  
Looked in Chapter 7 on COmmand-line processing - nothing.  SHould I drop an 
email to O'Reilly?

Mike M.

On Thursday 14 February 2002 01:32 pm, you wrote:
> On Thu, 14 Feb 2002, M. Mueller (bhu5nji) wrote:
> > why does the following command work:
> >
> > $kill -SIGHUP `cat /var/run/syslogd.pid`
>
> Backticks (``) mean "execute the command in the backticks and pass the
> result back." So in this case, kill gets two arguments: -SIGHUP and
> the STDOUT stream from the command:
> cat /var/run/syslogd.pid
> which is, presumably, the PID of the syslogd process; it is whatever the
> contents of /var/run/syslogd.pid are.
>
> > why does the following command *not* work:
> >
> > $kill -SIGHUP 'cat /var/run/syslogd.pid'
>
> Regular quotes ('') mean "treat the contents as a single argument instead
> of breaking them up in normal shell parsing manner." Again, kill gets two
> argument: -SIGHUP and the string:
> cat /var/run/syslogd.pid
> which is, with some certainty, not a PID (since PID's are numeric and "cat
> /var/run/syslogd.pid" is not).
>
> Hope this helps.
>
> ----------------------------------------------------------------------
> Andrew J Perrin - andrew_perrin at unc.edu - http://www.unc.edu/~aperrin
>  Assistant Professor of Sociology, U of North Carolina, Chapel Hill
>       269 Hamilton Hall, CB#3210, Chapel Hill, NC 27599-3210 USA
>
>
>
>
> _______________________________________________
> TriLUG mailing list
> http://www.trilug.org/mailman/listinfo/trilug



More information about the TriLUG mailing list