<div class="gmail_quote">On Wed, Sep 15, 2010 at 10:37 AM, Miano, Steven M. <span dir="ltr"><<a href="mailto:Steven.Miano@mybrighthouse.com">Steven.Miano@mybrighthouse.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I've always just done:<br>
<br></blockquote><div>Me too!</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
$ps aux | grep bash | grep -v grep<br>
<br></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Is there something wrong with that?<br></blockquote><div><br></div><div>No, just more typing and one more process.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
On the error in the book that's interesting, I wasn't able to reproduce the same error using the same command successively....8.04/LTS/i386<br></blockquote><div><br></div><div>Of course, you have to do something at the command line before running the command. I'll show you later what is.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
~Steven<br>
<br>
________________________________________<br>
From: <a href="mailto:ubuntu-us-fl-bounces@lists.ubuntu.com">ubuntu-us-fl-bounces@lists.ubuntu.com</a> [<a href="mailto:ubuntu-us-fl-bounces@lists.ubuntu.com">ubuntu-us-fl-bounces@lists.ubuntu.com</a>] On Behalf Of j.e.aneiros [<a href="mailto:jesus.aneiros@gmail.com">jesus.aneiros@gmail.com</a>]<br>
Sent: Wednesday, September 15, 2010 9:39 AM<br>
To: Mailing list for Ubuntu Florida LoCo Team<br>
Subject: [ubuntu-florida] Avoid That grep Command in grep Output<br>
<div><div></div><div class="h5"><br>
Hello everyone,<br>
<br>
I'm planning to send everyday at least a message to the list with something interesting about Linux. This is the first one.<br>
<br>
One week ago I bought the book "Official Ubuntu Server Book, The (2nd Edition)". Being a command line fan I went directly to the section "Cool tips and tricks". I started reading and I found out that the explanation of the first trick is in a certain way wrong.<br>
<br>
The idea behind the trick is to avoid the appearance of grep in resulting list for a command like:<br>
<br>
janeiros@harlie:~$ ps ax | grep bash<br>
13235 tty1 S 0:00 -bash<br>
13256 tty1 S+ 0:00 /bin/bash /usr/bin/startx<br>
16911 pts/0 Ss+ 0:00 -bash<br>
17005 pts/1 Ss 0:00 -bash<br>
17152 pts/1 S+ 0:00 grep --color=auto bash<br>
<br>
The authors suggest a "trick" running the command in this form:<br>
<br>
janeiros@harlie:~$ ps ax | grep [b]ash<br>
<br>
How come when I try the trick is OK the first time and wrong at the second one?<br>
<br>
janeiros@harlie:~$ ps ax | grep [b]ash<br>
13235 tty1 S 0:00 -bash<br>
13256 tty1 S+ 0:00 /bin/bash /usr/bin/startx<br>
16911 pts/0 Ss+ 0:00 -bash<br>
17005 pts/1 Ss 0:00 -bash<br>
<br>
You can see grep is gone.<br>
<br>
And now is back:<br>
<br>
janeiros@harlie:~$ ps ax | grep [b]ash<br>
13235 tty1 S 0:00 -bash<br>
13256 tty1 S+ 0:00 /bin/bash /usr/bin/startx<br>
16911 pts/0 Ss+ 0:00 -bash<br>
17005 pts/1 Ss 0:00 -bash<br>
17185 pts/1 S+ 0:00 grep --color=auto bash<br>
<br>
Of course, I did something in between that provoked the change! What was it? Let see if somebody find out what was. The authors' explanation for the trick is not exact!<br>
<br>
The explanation is right there at the command line!<br>
<br>
If nobody finds out I'll tell you later today.<br>
<br>
By the way there is an alternative to the trick but it's longer.<br>
<br>
Have a good day!<br>
<br>
PS. The outputs of the commands weren't edited at all.<br>
<br>
--<br>
J. E. Aneiros<br>
GNU/Linux User #190716 en <a href="http://counter.li.org" target="_blank">http://counter.li.org</a><br>
perl -e '$_=pack(c5,0105,0107,0123,0132,(1<<3)+2);y[A-Z][N-ZA-M];print;'<br>
PK fingerprint: 5179 917E 5B34 F073 E11A AFB3 4CB3 5301 4A80 F674<br>
<br>
<br>
</div></div>CONFIDENTIALITY NOTICE: This e-mail may contain information that is privileged, confidential or otherwise protected from disclosure. If you are not the intended recipient of this e-mail, please notify the sender immediately by return e-mail, purge it and do not disseminate or copy it.<br>
<font color="#888888"><br>
--<br>
Ubuntu-us-fl mailing list<br>
<a href="mailto:Ubuntu-us-fl@lists.ubuntu.com">Ubuntu-us-fl@lists.ubuntu.com</a><br>
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/ubuntu-us-fl" target="_blank">https://lists.ubuntu.com/mailman/listinfo/ubuntu-us-fl</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br><div>J. E. Aneiros</div><div>GNU/Linux User #190716 en <a href="http://counter.li.org" target="_blank">http://counter.li.org</a></div><div>perl -e '$_=pack(c5,0105,0107,0123,0132,(1<<3)+2);y[A-Z][N-ZA-M];print;'</div>
<div>PK fingerprint: 5179 917E 5B34 F073 E11A AFB3 4CB3 5301 4A80 F674</div><br>