?
Solved

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

Posted on 2014-03-18
2
Medium Priority
?
972 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 35

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

10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

Question has a verified solution.

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

The purpose of this article is to demonstrate how we can use conditional statements using Python.
Utilizing an array to gracefully append to a list of EmailAddresses
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month12 days, 17 hours left to enroll

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