0% found this document useful (0 votes)
923 views4 pages

A. B. C. D. E. The Answer Cannot Be Determined From The Information Given

The document provides the output of the history command from a bash shell session. It then asks 10 multiple choice questions about bash commands and shell behavior, based on the history output and provided transcript examples.

Uploaded by

JohnOlay
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
923 views4 pages

A. B. C. D. E. The Answer Cannot Be Determined From The Information Given

The document provides the output of the history command from a bash shell session. It then asks 10 multiple choice questions about bash commands and shell behavior, based on the history output and provided transcript examples.

Uploaded by

JohnOlay
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Use the following output from the history command to answer the following 2 questions.

Assume that the mentioned expressions are typed on the command line immediately
following the history command. Note that over 70 lines have been omitted from the output.
[student@station student]$ history
1 gimp rdu_map.png
2 bg
3 scp rdu_map.png @nimbus.example.com:/var/www/html/maps
...
81 gaim&
82 evolution&
83 ps aux | grepelvis
84 pkilloafd
85 ps aux | grepelvis
86 pgrep -u elvis
87 pgrep -ulelvis
88 pgrep --help
89 pgrep -luelvis
90 evolution&
91 history

Top of Form
rha030_bash_tes

1. On the following command line, what would be substituted for the expression !!?

A. evolution &

B. gimp rdu_map.png

C. prep -luelvis

D. history

E. The answer cannot be determined from the information given.


rha030_bash_tes

2. On the following command line, what would be substituted for the expression !s?

A. scp rdu_map.png @nimbus.example.com:/var/www/html/maps

B. pkilloafd

C. pgrep -luelvis

D. The answer cannot be determined from the information given.


The question is misguided, because !s is not a legitimate expression for history
E.
expansion.
rha030_bash_tes
3. In which file is a user's command history stored between bash sessions?

A. ~/.history

B. /tmp/.history_username, with username replaced with the user's name.

C. ~/.bash_history

D. Whichever file the BASH_HISTORY_FILE variable specifies.

E. None of the above


rha030_bash_tes

Which of the following commands would display (only) the contents of the LANG
4.
environment variable?

A. echo $LANG

B. echo ${LANG}

C. A and B

D. echo environ $LANG

E. All of the above


rha030_bash_tes

Which of the following commands would change a bash shell's working directory to a
5.
user's home directory?

A. cd

B. cd ~

C. A and B

D. cd `(echo $HOME)`

E. All of the above

In the following transcript, the user is trying to enable the nocaseglob shell option, but failing.
[student@station student]$ shoptnocaseglob
nocaseglob off
[student@station student]$ (shopt -s nocaseglob; set +f)
[student@station student]$ shoptnocaseglob
nocaseglob off
rha030_bash_tes

6. Why was the nocaseglob shell option not modified by the shoptbuiltin command?

The nocaseglob option was enabled, but it was enabled in a subshell. The original
A.
shell's shell nocaseglob option was not modified.
The wrong syntax for the shopt command was used. The correct syntax would be
B.
shopt +nocaseglob.
The nocaseglob option was enabled, but then immediately disabled by the following
C.
set command.
The wrong syntax for the shopt command was used. The correct syntax would be
D.
shopt -nocaseglob.

E. None of the above


rha030_bash_tes

Which of the following command lines would add the /usr/games directory to the current
7.
shell's search path for executable files?

A. PATH=$PATH:/usr/games

B. PATH=/usr/games

C. PATH+=/usr/games

D. (PATH=$PATH:/usr/games)

E. None of the above

Use the following transcript to answer the next question.


[student@station student]$ ps
PID TTY TIME CMD
9123 pts/3 00:00:00 bash
9297 pts/3 00:00:00 ps
[student@station student]$ echo $$ $? $USER $_
rha030_bash_tes

8. What would the output of the last command look like?

A. 9297 1 student echo

B. 9123 0 student ps

C. 9123 0 /home/student ps

D. There is enough information provided, but none of the above answers are correct.
E. There is not enough information provided to answer this question.

Use the following transcript to answer the next question.


[student@station student]$ A=aardvark
[student@station student]$ export B=brown bear
[student@station student]$ export C=camel
[student@station student]$ bash
[student@station student]$ echo 'A=$A' "B=$B" `C=$C`
rha030_bash_tes

9. What output did the echo command generate?

A. A=aardvark B=brown bear C=camel

B. A=$A B="brown bear" C=camel

C. A=$A B=brown

D. A= B=brown C=$C

E. A=aardvark B=brown C=$C

A bash command line produces the following output.


drwxrwxrwt 31 root root 4096 Sep 4 16:00 /tmp
it worked
rha030_bash_tes

10. Which of the following command lines could have produced the output above?

A. (ls -ld /tmp || echo "it worked")

B. ls -ld /tmp&& echo "it worked"

C. A and B

D. ls -ld /tmp + echo "it worked"

E. All of the above


Bottom of Form

You might also like