LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   ps -ef|grep -v root|grep apache<<result (https://www.linuxquestions.org/questions/linux-newbie-8/ps-ef%7Cgrep-v-root%7Cgrep-apache-result-96301/)

maelstrombob 09-24-2003 10:11 AM

ps -ef|grep -v root|grep apache<<result
 
i've typed in this line ps -ef|grep -v root|grep apache<<result

i got a prompt which looks like this: Bash me-]

if anyone can tell me what i did, i would appreciate it...it is definately over my head

druuna 09-24-2003 11:38 AM

You made a typo, that's what you did ;) Sorry, couldn't resist.......

Ok, a serious answer is also available.

The first 3 parts of the command you typed do what you probably expected

ps -ef|grep -v root|grep apache

ps -ef => list processes
grep -v root => exclude every line with 'root' in it
grep apache => only show lines with 'apache' in it.

If you put '<<result' behind that everything changes. Bash thinks that this is the first part of a here-document. Because it's still missing an end tag it will show your 'secondary' prompt (PS2) and expects input and an end tag.

If you would type result you would get your prompt back. Everything you typed in between will be taken as input for the command before <<result. This could have strange, even dangerous results if you don't know what effect this will have on the command in front of it (not in the example you've given).

You don't state your 'level' of experience with linux/unix. So I hope that I haven't oversimplified my answer. If, on the other hand, you still don't understand........ well that's why we are here :)


All times are GMT -5. The time now is 05:54 AM.