Web design careers - Because the process ID is stored in the

Because the process ID is stored in the second column, use awk to extract it. If more than one line matches, this function displays each process ID. For example, the following command getPID httpd returns the following list of process IDs on my system: 330 331 332 333 334 335 336 323 Readers who are using Linux or FreeBSD-based systems have to change this function slightly for it to function properly. The value of the variable PSOPTS should be -auwx on these systems. In Chapter 23, I will show you how to incorporate these changes into the function so that it runs on all versions of UNIX. Getting a User’s Numeric User ID Some shell scripts need to determine whether a user has sufficient permissions to execute commands. For example, an install script might need to run as root (UID 0) to modify system files correctly. In other instances, a script might need to detect whether a user has too many privileges. To check the user’s ID, you can use the id command, which can be run in two forms. The first form specifies a username whose ID should be returned. For example, the command $ id vathsa uid=501(vathsa) gid=100(users) groups=100(users) returns the UID for the user vathsa. The second form omits the user ID. In this form, the current user’s information is returned. $ id uid=500(ranga) gid=100(users) groups=100(users),101(ftpadmin) Your function supports both. ################################################ # Name: getUID # Desc: outputs a numeric user id # Args: $1 -> a user name (optional) ################################################
Please visit our professional web hosting services to find out about cheap and reliable webhost service that will surely answer all your demands.

Leave a Reply