LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux 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
  Search this Thread
Old 09-24-2003, 10:11 AM   #1
maelstrombob
LQ Newbie
 
Registered: Sep 2003
Posts: 4

Rep: Reputation: 0
Question 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
 
Old 09-24-2003, 11:38 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
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
 
  


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 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 13 12-04-2010 10:02 PM
Need to assign result of grep to var in PERL amytys Programming 1 09-23-2004 06:25 PM
ps -ef | grep iptables gives no result ? markraem Linux - Networking 1 07-07-2004 05:28 AM
how to grep within a script, and test result? bobbyr Programming 4 01-13-2004 12:11 PM
multiline grep result > multiple variable? mikshaw Linux - Software 5 12-25-2003 10:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:55 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