HP3000-L Archives

September 2001, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Ken Hirsch <[log in to unmask]>
Reply To:
Ken Hirsch <[log in to unmask]>
Date:
Mon, 17 Sep 2001 14:53:40 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (47 lines)
Your outer quote need to be double quotes so that  the shell variables are
interpolated.  This means that you have to backslash-escape any double
quotes and dollar signs with the double quotes.
i.e.
awk "\$2 != $WORK_PID {system(\"export  cmmain_flag=2\")}'


----- Original Message -----
From: "Carl McNamee" <[log in to unmask]>
To: <[log in to unmask]>
Sent: Monday, September 17, 2001 2:40 PM
Subject: Awk question


> I busy writing a shell script that is supposed to take down a particular
> application and then determine if the application actually quit.  If the
> application is still running then set a variable that will be used later
in
> the script.
>
> The line in the script I'm having problems with is:
>   ps -ef|grep cmMain | awk '$2 != $WORK_PID {system("export
> cmmain_flag=2")}'
> When this command runs I receive the error "awk: Field $() is not
correct".
> The $WORK_PID is an environment variable that was previously set to the
pid
> of the current process.  What I'm trying to do with the awk command is
> filter out the grep command finding itself (which seems to happen fairly
> regularly and completely screws up the rest of the script!).  I tried
> surrounding the $WORK_DIR in quotes (single, double and tilde) but that
did
> not fix the problem.
>
> Thoughts?  Comments?  Criticism?
>
> Carl McNamee
> Systems Administrator
> Billing Concepts
> (210) 949-7282
>
> * To join/leave the list, search archives, change list settings, *
> * etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2