61.
Where is the best location for the current directory indicator (.) to reside in root’s PATH
environment variable?
- A.Before all other directories
- B.After all other directories
- C.At any location except the last one
- D.Wherever is convenient
- E.Nowhere; it shouldn’t be in root’s path
- Answer & Explanation
- Report
Answer : [E]
Explanation :
Explanation :
The current directory indicator is particularly dangerous in root’s PATH environment variable because it can be used by unscrupulous local users to trick root into running programs of the unscrupulous user’s design. Thus, option E is correct and all the other options are incorrect. |
62.
You want to create a shortcut for the command cd ~/papers/trade. Which of the following
lines, if entered in a bash startup script, will accomplish this goal?
- A.alias cdpt=’cd ~/papers/trade’
- B.export cdpt=’cd ~/papers/trade’
- C.cd ~/papers/trade
- D.shortcut cdpt “cd ~/papers/trade”
- E.env cdpt `cd ~/papers/trade`
- Answer & Explanation
- Report
Answer : [A]
Explanation :
Explanation :
The alias built-in command creates a duplicate name for a (potentially much longer) command. Option A shows the correct syntax for using this built-in command; it causes the new alias cdpt to work like the much longer cd ~/papers/trade. The export command in option B creates an environment variable called cdpt that holds the value cd ~/papers/trade. This will have no useful effect. Option C, if placed in a bash startup script, will cause the user’s current directory to shift to ~/papers/trade immediately after the user logs in. There is no standard shortcut command, so option D is meaningless. Although env is a valid command, it’s used incorrectly in option E, and so this option is incorrect. |
63.
What is the purpose of the EDITOR environment variable?
- A.Set to Y (the default), the shell environment permits editing of commands; set to N, such editing is disallowed.
- B.It specifies the filename of the text editor that bash uses by default while you’re entering commands at its prompt.
- C.If you type edit filename at a command prompt, the program specified by EDITOR will be launched.
- D.Set to GUI, programs call a GUI editor; set to TEXT, programs call a text-based editor.
- E.Some programs refer to EDITOR to determine what external editor to launch when they need to launch one.
- Answer & Explanation
- Report
Answer : [E]
Explanation :
Explanation :
Some programs use the EDITOR environment variable as described in option E. Contrary to option A, the EDITOR environment variable has nothing to do with command-line editing. When you’re typing at a bash command prompt, bash itself provides simple editing features, so option B is incorrect. (You can launch the editor specified by $EDITOR by typing Ctrl+X followed by Ctrl+E, though.) The edit command doesn’t behave as option C suggests. (This command may be configured differently on different systems.) You can create links called GUI and TEXT to have the EDITOR environment variable behave as option D suggests, but this isn’t a normal configuration. |
64.
In what environment variable is the current working directory stored?
- A.PATH
- B.CWD
- C.PWD
- D.PRESENT
- E.WORKING
- Answer & Explanation
- Report
Answer : [C]
Explanation :
Explanation :
The PWD environment variable holds the present working directory, so option C is correct. The PATH environment variable (option A) holds a colon-delimited list of directories in which executable programs are stored so that they may be run without specifying their complete pathnames. There are no standard CWD, PRESENT, or WORKING environment variables, so options B, D, and E are all incorrect. |
65.
Which of the following commands, if typed in a bash shell, will create an environment
variable called MYVAR with the contents mystuff that will be accessible to subsequently
launched programs?
- A.export MYVAR=’mystuff’
- B.MYVAR=’mystuff’
- C.$MYVAR==mystuff
- D.echo $MYVAR mystuff
- E.setenv MYVAR mystuff
- Answer & Explanation
- Report
Answer : [A]
Explanation :
Explanation :
Option A creates the desired environment variable. Option B creates a local variable—but not an environment variable—called MYVAR, holding the value mystuff. After typing option B, you can also type export MYVAR to achieve the desired goal, but option B by itself is insufficient. Option C isn’t a valid bash shell command. Option D displays the contents of the MYVAR variable and also echoes mystuff to the screen, but it doesn’t change the contents of any environment variable. Option E’s setenv isn’t a valid bash command, but it will set an environment variable in tcsh. |