March 2002
Beginner
504 pages
10h 47m
English
| 1: | Given the following shell function
lspids() { /bin/ps -ef | grep "$1"| grep -v grep ; }
make the necessary changes so that when the function is executed as follows $ lspid -h ssh the output looks like this: UID PID PPID C STIME TTY TIME COMMAND root 2121 1 0 Nov 16 ? 0:14 /opt/bin/sshd Also, when the function executes as $ lspid ssh the output looks like this: root 2121 1 0 Nov 16 ? 0:14 /opt/bin/sshd Here you are using ssh as the word specified to grep, but your function should be able to use any word as an argument. Also, validate that you have enough arguments before executing the ps command. If you are using a Linux or BSD-based system, please use the following version of the function lspids as a starting point instead ... |
Read now
Unlock full access