Hello,
Grep is a filter, meaning that you have to send something to grep before grep can do anything. For example:
ps -aux | grep kc0arf
on a *nix machine will list out all of the processes that have kc0arf on the output of the ps command.
So, you need to use the who command to find out how many users are logged onto your machine. That is done by:
who
And you see all of the users. But let's look further:
man who
and you will see some options. Looking, we see who -- count.
Take a look at that, and you should find what you are looking for.
Unfortunately, I do not know further on how to do a conditional at the command prompt... I usually write a short bash script that has if/then/else logic nice and neatly formatted.
Let us know.
Christian
kc0arf
Posting Virtuoso
1,937 posts since Mar 2004
Reputation Points: 121
Solved Threads: 57
Unfortunately, I do not know further on how to do a conditional at the command prompt... I usually write a short bash script that has if/then/else logic nice and neatly formatted.
You'd just write the same thing at the prompt, just use semicolons instead of carriage returns:
bash-2.05# <strong>if [ foo ] ; then bar ; else echo "not foo or bar" ; fi</strong>
alc6379
Cookie... That's it
2,820 posts since Dec 2003
Reputation Points: 186
Solved Threads: 147