LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Newbie
User Name
Password
Linux - Newbie This forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Thread Tools Search this Thread
Old 09-24-2003, 11:11 AM   #1
maelstrombob
LQ Newbie
 
Registered: Sep 2003
Posts: 4
Thanked: 0
Question ps -ef|grep -v root|grep apache<<result


[Log in to get rid of this advertisement]
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
maelstrombob is offline     Reply With Quote
Old 09-24-2003, 12:38 PM   #2
druuna
Senior Member
 
Registered: Sep 2003
Location: netherlands
Distribution: lfs
Posts: 3,482
Thanked: 112
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
druuna is offline     Reply With Quote

Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using find and grep - how to exclude a result ? graziano1968 Linux - General 12 06-29-2005 10:47 AM
Need to assign result of grep to var in PERL amytys Programming 1 09-23-2004 07:25 PM
ps -ef | grep iptables gives no result ? markraem Linux - Networking 1 07-07-2004 06:28 AM
how to grep within a script, and test result? bobbyr Programming 4 01-13-2004 01:11 PM
multiline grep result > multiple variable? mikshaw Linux - Software 5 12-25-2003 11:13 PM


All times are GMT -5. The time now is 05:55 PM.

Main Menu
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.
Advertisement
Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Click Here to receive a complimentary subscription courtesy of LQ.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration