AWK for logins -p
By doing logins -p, I can see a list of users with blank passwords e.g
user1 111 other 1 user2 112 other 1 user3 113 other 1 I am trying to print "yes" when there are users with blank password and "no" if there arent any users with blank passwords. I had used Code:
logins -p | awk -F"" '{if($!="")print "yes"; else print "no"}' yes yes yes So how do I make output it such that it prints one "yes" only? Thanks. |
Try this...
Hello!
Should work this way: Code:
if [ "$(logins -p | wc -l)" -ne 0 ]; then echo yes; else echo no; fi Regards, Heraton |
Quote:
Code:
wc -l Code:
logins -p | wc -l |
The wc cmd can return various numbers, all integer http://linux.die.net/man/1/wc
|
All times are GMT -5. The time now is 12:03 PM. |