简体   繁体   中英

Suppress warning give in ps command output

When I run the ps command i get a warning saying "Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ"

How do i suppress this warning? Is there some system setting that i must do for this. The command that i fire is :

[root@localhost home]# ps -aux | grep "curl -s -o Test" 

Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ
root      4856  0.0  0.0   4044   672 pts/0    S+   07:20   0:00 grep curl -s -o Test
[root@localhost home]# 

Note that I have to fire the exact same command as above. That is why i am looking for some system setting that will suppress the warning.

From the FAQ:

Why does "ps -aux" complain about a bogus '-'?

According to the POSIX and UNIX standards, the above command asks to display all processes with a TTY (generally the commands users are running) plus all processes owned by a user named "x". If that user doesn't exist, then ps will assume you really meant "ps aux". The warning is given to gently break you of a habit that will cause you trouble if a user named "x" were created.

On my system, where a user x does not exist, I get no warning message. Therefore one can surmise that, on your system, a user named x exists.

If you can remove user x you can probably get the warning to go away. If not, you are stuck with the warning message.

Try:

 ps -aux | grep "curl -s -o Test" 2> /dev/null

Or a variant of that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM