User jack, whose account is configured to use the korn shell, logs in and examines the value of his
PATH environment variable:
jack@solaris: echo $PATH
/usr/gnu/bin:/usr/bin:/usr/sbin:/sbin
There is a shell script in jack’s home directory called useradd:
-r-xr-xr-x 2 jack other 1239 2012-01-05 11:42 useradd
While in his home directory, jack attempts to run the script:
jack@solaris: useradd
What will happen, and why?
A.
He will get a “file not found” error, because the current directory is not in his seaech path.
B.
He will get a “file not found” error, because his home directory is not in his search path.
C.
The useradd script will execute, because jack is in the same directory that the script is located
in.
D.
The command /user/sbin/useradd will execute, because it is the last match in the search path.
E.
The command /user/sbin/useradd will execute, because it is the first match in the search path.
E
E, the first match
Attencion… “/user/” — not “/usr/” …..
C can’t be right. You explicit need ./ to execute a File in Solaris11, if it’s not in the Path.
A and B are correct, if there is not E.
D is wrong, typo or not…
If there is a typo in D and E ( /usr/ and not /user/ ) the answer is “E”: First match.
There is no ‘useradd’ in /usr/gnu/bin
The ‘useradd’ binary is in /usr/sbin
/sbin is linked to /usr/sbin, so I would be leaning towards D