15 points Determine if homeusersbin is a part of a users PAT
(15 points) Determine if /home/users/bin is a part of a user’s PATH in .profile. (Hint: this command will first get the line containing PATH= and then see if that path is present – grep X 2)
Solution
I.GREP:
As there can be considerable output, it can be convenient to modify this command so that it displays just the PATH environmental variable and its value. This can be accomplished by using a pipe to transfer the output of env to the grep filter and use PATH as an argument to grep, example as show in bellow
env | grep PATH
II.ECHO:
Another way to view the contents of just PATH alone is by using the echocommand with $PATH as an argument:
echo $PATH
III.ADD DIRETORY:
It is a simple matter to add a directory to a user\'s PATH variable. It can be accomplished for the current session by using the following command, in which directory is the full path of the directory to be entered:
PATH=\"directory:$PATH\"
For example, to add the directory /usr/sbin, the following would be used:
PATH=\"/usr/sbin:$PATH\"
