LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-13-2005, 02:22 PM   #1
slinky2004
Member
 
Registered: Oct 2004
Posts: 309

Rep: Reputation: 30
ps -A|grep "sh" adds shells?


when my comp first boots and i log into the cli, it gives me a shell and if i echo $SHLVL it says 1, apparently indicating that i have one shell open. but if i run a ps -A|grep "sh" it shows two processes of bash running, with two different process numbers. but if i run a plain ps -A , it only shows one bash, whats with that? the same thing happens once i've loaded X with "startx" except then my $SHLVL is 4, ps -A shows 4 shells: 3 bash and 1 sh, and ps -A|grep "sh" shows 4 shells(an extra bash). why does that happen, is grep picking up some hidden lines in my ps -A? and why does X have to start so many shells?
 
Old 09-13-2005, 03:31 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Can't give you a quote for this one, but I seem to recall
that the | will make the second command execute in a sub-
shell of its own.


Cheers,
Tink
 
Old 09-13-2005, 07:32 PM   #3
slinky2004
Member
 
Registered: Oct 2004
Posts: 309

Original Poster
Rep: Reputation: 30
ah ha! thanks
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
"grep" Command (SystemV/68 system) xtremexp Other *NIX 3 05-28-2005 07:25 PM
How to use "OR" option in a grep command. sumitarun Programming 3 04-18-2005 01:44 AM
"grep" and "tcpdump" Magsol Linux - Newbie 2 03-25-2005 11:56 PM
"Undeleting" data using grep, but get "grep: memory exhausted" error SammyK Linux - Software 2 03-13-2004 03:11 PM
"grep: /etc/issue: No such file or directory" hunter_one Linux - Software 6 10-15-2003 03:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration