|
| Recent
Articles |

Managing A Worldwide Print Infrastructure From... Company - This US based company is one of the world's largest manufacturers of automotive parts and sub-assemblies in the world. Their customers include: BMW, Daimler-Chrysler, Ford, General Motors, Honda, Mazda, Mitsubishi, Nissan, Renault, Rover, Toyota and...
Linux Training: Courses vs. Videos Beware of loosing your shirt going to a Linux training course taught in a classroom. You just might regret spending your hard-earned cash - and likely won't be able to get it back! As a new Linux user, you'll find that...
System Administrator And System Engineer Jobs Systems Administrators are expected to be efficient in diagnosing and fixing problems fast and with accuracy. It is essential for a system administrator to have a substantial understanding of various programming languages used for computing various tasks. In addition...
A Quick Way to OpenBSD and How to Use it I have been a BSD user since the late 1990's. I made my own FreeBSD distro - 1fcdbsd or One Floppy CD Audio and MP3 Player (http://www.freebsd.nfo.sk/), and I gained some experience with the BSD world, which rather...
Dell's IdeaStorm: Social Media in Motion When most companies decide to embrace social media, they usually use it as a vehicle to market new products and services, while at the same time seeking transparency. When Dell launched its IdeaStorm website, it departed from the normal “this is what we’re doing”...
|
 |
|
|
07.03.07
Bug In Shell Script Using Awk To Read /etc/passwd?
By
Dave Taylor
In your book Wicked Cool Shell Scripts, on p. 115, Script #40 Reporting Disk Hogs, on the 8th line the second part of the line reads:
I am very new to shell scripting, so I am probably just not understanding how this line should be interpreted. In my Linux class, I have been learning that in the /etc/passwed file the 1st field is username, the 2nd field is password (x), and the third field is the UID, so wouldn't the $2 above really be $3 so that the script would be checking to see if the UID field, which is field 3 is greater that 99, not the password field,which is field 2? Please let me know, since this is confusing to me. Thanks for your help.
You're right. But you haven't noticed that this is part of a pipe in that particular script:
The cut just extracts the name and uid from the password file, at which point the second field *is* the UID, and this way we can use awk to only print the username of accounts with uid's greater than 99.
| Learn How We Increased Conversion By 816% and Become A Certified Online Testing Professional™
Click Here |
|
Remember, here's a typical few lines from the Linux / Unix /etc/passwd file:
But that's another story. :-)
Comments
About the Author: Dave Taylor has been involved with the Internet since 1980 and is
internationally known as an expert on both business and technology issues.
Holder of an MSEd and MBA, author of twenty books and founder of four
startups, he also runs a strategic marketing company and consults with firms
seeking the best approach to working with weblogs and social networks. Dave
is an award-winning speaker and frequent guest on radio and podcast
programs.
AskDaveTaylor.com
http://www.intuitive.com/blog/
|