What is the purpose of the PATH variable?

What will be an ideal response?


When you give the shell a simple filename as a command, the shell searches
through directories specified by the PATH variable for the program you
want to execute. It looks for a file that has the same name as the command
and that you have execute permission for (a compiled program) or read and
execute permission for (a shell script).
a. Set the PATH variable and place it in the environment so it causes the
shell to search the following directories in order:
• /usr/local/bin
• /usr/bin
• /bin
• /usr/kerberos/bin
• The bin directory in your home directory
• The working directory
The following command sets the PATH variable as specified and places
it in the environment:

$ export PATH=/usr/local/bin:/usr/bin:/bin:/usr/kerberos/bin:~/bin:.:

b. If there is an executable file named doit in /usr/bin and another file with
the same name in your ~/bin directory, which one will be executed?
The /usr/bin/doit file will be executed because /usr/bin appears before
~/bin in PATH.
c. If your PATH variable is not set to search the working directory, how can
you execute a program located there?
You can execute the command by giving either an absolute pathname or
a relative pathname such as ./program-name.
d. Which command can you use to add the directory /usr/games to the end
of the list of directories in PATH?
$ PATH=$PATH:/usr/games

Computer Science & Information Technology

You might also like to view...

Answer the following statements true (T) or false (F)

1. Every programmer must know all the details of what that programmer's team mates are doing in their projects to do the work assigned. Why? 2. Procedural abstraction involves information hiding in that only the contract between the programmer using the function (the client) and author of a function is known to either. 3. Code after a return or a call to the exit function is executed will not be executed. function, and returns to the operating system if return is executed out of main. If exit is executed anywhere, the program is terminated and control is returned to the operating system. 4. A sequence of calls to the library function rand() generates mathematically correct random number sequences.

Computer Science & Information Technology

Which of the following jQuery events is triggered when a form element receives focus?

a. focus out b. focus c. hover d. focus in

Computer Science & Information Technology

A ________ can be used to send out a DoS attack

A) worm B) rootkit C) botnet D) keylogger

Computer Science & Information Technology

The Accessibility Checker locates accessibility issues and assigns them to a category. Which of the following is NOT one of the Accessibility Checker categories?

A) Warning B) Error C) Tip D) Issue

Computer Science & Information Technology