LinuxQuestions.org
Help answer threads with 0 replies.
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 10-12-2011, 08:47 AM   #1
Dan Unix
LQ Newbie
 
Registered: Oct 2011
Posts: 2

Rep: Reputation: Disabled
trying to figure out some commands for class


who | grep '^mary'-- show if Mary is the first one logged in. is this correct?

grep | '[Uu]nix' ch?/* Can't figure this one out
 
Old 10-12-2011, 09:29 AM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,252

Rep: Reputation: 2685Reputation: 2685Reputation: 2685Reputation: 2685Reputation: 2685Reputation: 2685Reputation: 2685Reputation: 2685Reputation: 2685Reputation: 2685Reputation: 2685
Quote:
who | grep '^mary'-- show if Mary is the first one logged in. is this correct?
You need to look at what the output of who is on its own and then look into what '^' means in a regular expression.
Quote:
grep | '[Uu]nix' ch?/* Can't figure this one out
Are you sure this is written correctly? Nothing on the RHS is a command so I do not believe the pipe should be there.
 
Old 10-12-2011, 10:12 AM   #3
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
I also think the pipe must be a mistake. Without it it becomes a proper grep command.

ch?/* appears to be a shell globbing pattern.

http://mywiki.wooledge.org/glob

And please use [code][/code] tags around your code, to preserve formatting and to improve readability.
 
Old 10-12-2011, 04:07 PM   #4
Dan Unix
LQ Newbie
 
Registered: Oct 2011
Posts: 2

Original Poster
Rep: Reputation: Disabled
Unhappy

Quote:
Originally Posted by Dan Unix View Post
who | grep '^mary'-- show if Mary is the first one logged in. is this correct?

grep | '[Uu]nix' ch?/* Can't figure this one out
You are correct I put the pipe in by mistake

The who command shows who is logged in. then after pipe it will show if mary is the first one logged in in the list of those logged in.

still have no idea on the second one. First semester in intro to linux working on regular expressions. Missed class for medical reasons and far behind. Sachool doesnt have a tutor for this class. Trying my best
 
Old 10-12-2011, 09:05 PM   #5
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,252

Rep: Reputation: 2685Reputation: 2685Reputation: 2685Reputation: 2685Reputation: 2685Reputation: 2685Reputation: 2685Reputation: 2685Reputation: 2685Reputation: 2685Reputation: 2685
Quote:
The who command shows who is logged in
Yes it does but check the output as it is not a list of names in the following format:
Code:
mary tim fred
But rather a list of names in the following format
Code:
tim <more information here>
mary <more information here>
fred <more information here>
From the example above your first command string will still report back about mary but she is not necessarily the first user logged on
Quote:
still have no idea on the second one
Please explain what you do not understand about the second command string?

Maybe if you explain to us what each part is doing:

grep -
'[Uu]nix' -
ch?/* - (David gave you a clue about this one)
 
  


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
[SOLVED] Python n00b: promoting a derived class to base class? CoderMan Programming 2 03-11-2010 02:46 PM
C++ templated Node class: pointers to different instantated class types jhwilliams Programming 3 08-20-2007 07:20 PM
Does derivated class inherit base class destructor (constructor)? kornerr Programming 2 08-23-2006 09:05 AM
Which C++ editor in Linux has the class view/class browser feature imaginationworks Programming 7 05-22-2006 12:09 AM
BlackBox.class & VerifierBug.class virus ??? dalek Linux - Security 4 02-29-2004 09:55 AM


All times are GMT -5. The time now is 12:24 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration