who command
Hi guys
What Bash script do I use to test the true of false results of the command 'who | grep pts' how do I assign the results to a variable? Thank you Dory |
Hi, and welcome to LQ!
The result is in $? Code:
who | grep pts > /dev/null 2>&1 Cheers, Tink |
Tink
echo $? produces 1 or 0 result = $? #produces an error( -bash: results: command not found ) thanks Dory |
Sorry about that; give the spaces around the = a miss.
And yes, 0 is success, 1 is failure. Cheers, Tink |
Tink
Thank you for your help Dory |
You're welcome, glad it works for you.
Cheers, Tink |
All times are GMT -5. The time now is 01:50 PM. |