Click to See Complete Forum and Search --> : writing a script


hotlantas69
05-16-2004, 01:22 PM
I'm trying to write a command on a single line to launch a project only if the numbers of users is less than 10.
So far this is what I know

who | grep [ '< 10 users-on']
I'm lost

x_Ray
05-16-2004, 07:00 PM
The whole deal has to be on one line?

try:

if [[ "$(who -q|grep \#|cut -d'=' -f2)" -lt "10" ]]; then RUN_COMMAND; fi

replacing RUN_COMMAND with the command of course...

hotlantas69
05-16-2004, 08:55 PM
Thanks for the help, just lost on the if and then.