[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Error msg when running ps -awx on RedHat linux under sh

Posted on 2014-03-18
2
Medium Priority
?
1,024 Views
Last Modified: 2014-03-18
I am trying to do a simple ps to get a process id in /bin/sh in RedHat Linux and am getting the error:

  "Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ"

Here is a sample script:

  #!/bin/sh

  PID=`/bin/ps -awx | grep coda | grep -v grep | /bin/awk '{ print $1}'`;
  echo "PID is: $PID"

but it DOES print out the proper PID...

What is the issue with this error and how can I get rid of it?

Thanks
-James
0
Comment
Question by:James Talvy
2 Comments
 
LVL 36

Accepted Solution

by:
Seth Simmons earned 2000 total points
ID: 39936921
get rid of the - after ps
just ps awx
0
 
LVL 1

Author Comment

by:James Talvy
ID: 39936938
Yes... silly me to ask the question and THEN do the google...

Didn't even occur to me since I have been using UNIX for 20 years and ps -aef doesn't yield this error.
0

Featured Post

Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses
Course of the Month17 days, 17 hours left to enroll

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question