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:
Carl McNamee <[log in to unmask]>
Reply To:
Carl McNamee <[log in to unmask]>
Date:
Tue, 18 Sep 2001 09:37:16 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (69 lines)
Good thought! I played with it and now get the message "test: Specify a
parameter with this command."  I also placed a \ in front of the $WORK_DIR
with the same result.  Sigh....

I put a display in the script just before the awk command to display the
$WORK_DIR variable and it does have data in it.  Any thoughts on this new
wrinkle?

I really didn't think this project would be so time consuming!

Carl

-----Original Message-----
From: Ken Hirsch [mailto:[log in to unmask]]
Sent: Monday, September 17, 2001 1:54 PM
To: [log in to unmask]
Subject: Re: [HP3000-L] Awk question


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 *

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

ATOM RSS1 RSS2