3 ms·
That's impressive, both the awk and the lisp versions of that code seem pretty obfuscated.
by kingkilr 15y ago
That's impressive, both the awk and the lisp versions of that code seem pretty obfuscated.
- irahul 15y agoThe awk version looks idiomatic to me. Except that I will take the FS out: awk -F: '$6=="/sbin/nologin" {print $1}' /etc/passwd
- d0mine 15y agoThere might be off by one error. On my system the following works: awk -F: '$7=="/usr/sbin/nologin" {print $1}' /etc/passwd Or awk -F: '$7 ~ /bin\/nologin$/ {print $1}' /etc/passwd
- irahul 15y agoYes, indeed it should be $7 instead of $6. I didn't run it when I posted the comment. I just copied it from the article.