Solved

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

Posted on 2014-03-18
2
931 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 34

Accepted Solution

by:
Seth Simmons earned 500 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Rate limit for DNS queries 7 75
Delete a folder on a linux computer on a regular basis 10 37
Ubuntu Apache Webserver - File Permissions 5 42
ignore other .htaccess 2 45
If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
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.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

777 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