156 M/C Questions -1- 156 M/C Questions -2- 6. If x=5 and y=5, which command sequence correctly compares the two numbers as PRINT Name: LAB Section: equal and prints OK? Test Version: 521 One-Answer Multiple Choice 156 Questions a. if test x -eq y ; then echo OK ; fi b. if [ x = y ] ; then echo OK ; fi ☞ Read all the words of these instructions and both sides (back and front) of all pages. c. if test $x -eq $y ; then echo OK ; fi ☞ Use your full, unabbreviated name on the mark-sense form. Do not abbreviate your name. d. if ( x == y ) ; then echo OK ; fi ☞ Put the three-digit Test Version above into NO. OF QUESTIONS and NO. OF STUDENTS e. if [ $x==$y ] ; then echo OK ; fi ☞ Fill in the bubbles with pencil only, no pen. Enter your NAME, Test Version, and answers. ☞ Manage your time. Answer questions you know, first. One Answer per question. 7. Of the following directories, which would you expect to contain the most system administration commands that require root privileges? a. /usr/bin b. /usr/local/bin 1. In a shell case structure, the case segment that will GLOB match the text x, y, c. /usr/sbin d. /sys/admin/bin or z, is coded as e. /bin a. x,y,z ) b. x|y|z ) c. x:y:z ) 8. If the current directory contains files abc, bbc, cbc, and bbc contains just the line d. x\y\z ) e. x/y/z ) dbd, what is the output of the following command: grep "bb*" bbc 2. What is the output (if any) of this bash shell program fragment? (There are blanks a. cbc b. dbd c. bbc between all the letters in the word list section of the for loop.) d. an error message e. no output str='' 9. Fill in the blanks. The chroot program takes a(n) _____ which will be the ____ for x in l i n u x r o c k s ; do for a shell or a command. str="$x$str" a. command, argument b. option, input done c. directory, argument d. input, option echo "$str" e. argument, ROOT directory a. xxxxxxxxxx b. l i n u x r o c k s 10. What would the following command do: at 8pm c. skcorxunil d. l a. list the user’s cron jobs that will run at 8pm e. linux b. run the user’s crontab jobs once at 8pm 3. If a=1 and b=1, which command sequence correctly compares the two numbers as c. run the user’s crontab jobs every day at 8pm equal and prints OK? d. issue an error message a. if [ $a==$b ] ; then echo OK ; fi e. read commands from stdin b. if [ $a -eq $b ] ; then echo OK ; fi 11. If you have a file mytasks of commands in crontab format, you could submit c. if test a -eq b ; then echo OK ; fi that file to be your live crontab file by running which of the following d. if ( a == b ) ; then echo OK ; fi commands? e. if [ a = b ] ; then echo OK ; fi a. crontab -l mytasks b. crontab < mytasks 4. Which of the following commands would you use to start the ntpd daemon, if you c. crontab -r mytasks d. crontab -e mytasks had just installed it and if it were not already running? e. echo mytasks | crond a. service ntpd start b. kill -9 ntpd 12. Which of the following commands on a Unix/Linux system displays a list of c. chkconfig ntpd on d. go ntpd processes running on the system? e. ntpd service on a. listtop b. top c. toplist 5. If foo is a directory that contains only the file bar and /dir1 is an empty d. pstop e. psls directory, what is in /dir1 after running the following command? rsync -avH foo/. /dir1 13. What is the output on your screen of this command line: echo foo | sed 's/foo/BAR/' a. foo b. dir1 c. bar a. bar b. BAR d. a symlink to foo e. nothing c. no output on screen d. foo e. FOO CST 8177 − Winter 2015 − Practice Pool #2 Wenjuan Jiang & Ian Allen CST 8177 − Winter 2015 − Practice Pool #2 Wenjuan Jiang & Ian Allen 156 M/C Questions -3- 156 M/C Questions -4- 14. What is the output of the following sequence of bash commands: 22. A shell script named bar is executed as follows: echo 'Good-day World' | sed -e 's/^/99/g' ./bar a "b c" 'a ' a. 99Good-day 99World b. 99ood-day World Inside the script is the line: head "$*" c. Good-day World d. 99Good-day World How many arguments are passed to the head command inside the script? e. 99ood-day 99orld a. 3 b. 2 c. 4 d. 5 e. 1 15. If foo is a directory that contains only the file bar and /dir1 is an empty 23. Which of the following is an argument to the kill command? directory, what is in /dir1 after running the following command? a. Effective Group ID b. Process ID rsync -avH foo/ /dir1 c. CPU identifier d. Root Process ID a. nothing b. foo c. dir1 e. Effective User ID d. a symlink to foo e. bar 24. What would be the output of the following command line: 16. What would be the output of the following command line: echo a b c d | awk '{print $2}' echo a b c | awk '{print $NF}' a. b b. no output c. c d a. no output b. c c. 3 d. $2 e. a b d. a b c e. $NF 25. If a shell script myscript.sh is called this way: 17. Which line below passes three separate arguments to the sort command when ./myscript.sh a b c placed inside a shell script named foo invoked by the command line: and the first line inside the script below the script header is ./foo 111 222 333 echo "$#$1"; shift a. sort "$*" b. sort "$@" what is the output of that line? c. sort "$#" d. sort "$1 $2 $3" a. 3b b. 4c c. 2b d. 3a e. 2a e. sort "$? $? $?" 26. Which of the following commands would be used to add the user myuser to the 18. To see a list of disk partitions that the kernel has detected, you could look at the group wheel? contents of which file? a. groupmod -a myuser wheel a. /etc/partitions b. /dev/partitions b. groupadd -a wheel myuser c. /lib/partitions d. /dev/sda c. gpasswd -a myuser wheel e. /proc/partitions d. useradd myuser wheel 19. Inside a bash shell script, which of the following would expand to one word e. usrgrp myuser wheel containing all of the arguments that were passed to the script? 27. If the file foo in the current directory contains just the line dbd, what is the output a. "$@" b. "$*" c. "$0" d. "$#" e. "$?" of the following command: grep '[[:alpha:]]' foo 20. Which of the following commands would you use configure the httpd daemon to a. 123 b. no output c. foo not run in runlevels 2,3,4, and 5? d. dbd e. an error message a. chkconfig httpd off 28. In an argument to rsync or scp a colon would come immediately after a b. service httpd off a. remote host b. local file c. relative pathname c. httpd run 16 d. local host e. remote file d. runlevel httpd off 29. Which of the following PATH statements makes the most sense? e. httpd --levels 2345 off a. PATH=/bin:/usr/bin:/etc 21. Which command sequence correctly searches for foo and then prints the date if it b. PATH=/bin/sh:/usr/bin:/etc:/bin is found inside the file bar? c. PATH=/bin/ls:/etc:/usr/bin a. if test foo bar ; then date ; fi d. PATH=/bin:/usr/bin:/etc/passwd b. if grep &1 "... " b. echo 1>&2 "... " c. /var1 /var c. echo 1<&2 "... " d. echo 2<$1 "... " d. /home /var/home e. echo 2>$1 "... " e. /var/home /home 65. Which of the following commands could be used to bring a system into single user 73. Which of the following PATH statements makes the most sense? mode? a. PATH=/bin/ls:/etc:/usr/bin a. shutdown now b. telinit 6 b. PATH=/usr:/bin:/usr/bin:/etc c. shutdown -h now d. telinit 0 c. PATH=/bin:/usr/bin:/etc/passwd e. init 0 d. PATH=/bin/sh:/usr/bin:/etc:/bin 66. In the /etc/suoders file, what word goes in front of ALL=(ALL) ALL to e. PATH=/bin:/bin/cat:/usr/bin allow members of the group wheel to run commands as root? 74. If the file foo in the current directory contains just the line dbd, what is the output a. sudoers b. %wheel c. wheel of the following command: grep '[b1]' foo d. %sudoers e. #wheel a. no output b. foo c. an error message 67. Which of the following would result in a "true" exit status? d. dbd e. 123 a. [ '00' = "0" ] b. [ 00 = 0 ] 75. If a script named bar contains a loop that starts: for i do c. [ '00' -eq "0" ] d. [ '00' != "00" ] and the script is executed using this command line: e. [ '00' -ne "0" ] ./bar a ' b d ' e f " g h " a how many times will the loop iterate? 68. Which of the following commands would you use configure the ntpd daemon to a. 7 iterations b. 1 iteration c. 6 iterations run in runlevels 2,3,4, and 5? d. 8 iterations e. 9 iterations a. runlevel ntpd 2345 b. service ntpd 2345 c. ntpd run 2345 d. ntpd --levels 2345 e. chkconfig ntpd on CST 8177 − Winter 2015 − Practice Pool #2 Wenjuan Jiang & Ian Allen CST 8177 − Winter 2015 − Practice Pool #2 Wenjuan Jiang & Ian Allen 156 M/C Questions -11- 156 M/C Questions -12- 76. To resume a stopped process in the background using Job Control, where N is the 85. Given the following command line: read one two three job number of the process and PID is its process ID, you would type which user keyboard input line below will assign the text bb to the shell variable a. fg PID b. fg %PID c. bg %N named two? d. bg %PID e. fg N a. aa:bb:cc 77. Inside a bash shell script, which of the following would expand to the number of b. aa;bb;cc arguments passed to the script? c. aa,bb,cc a. "$0" b. "$@" c. "$#" d. "$?" e. "$*" d. one=aa two=bb three=cc e. aa bb cc 78. If archive.tgz is a compressed tar archive, which command could you run to produce a listing of its contents without extracting it? 86. If guru=linus then which one of the following case patterns will match this a. tar tzvf archive.tgz b. tar tzvf archive statement: case "$guru" in c. tar tgz archive.tgz d. tar xzvf archive.tgz a. "linu?" ) echo yes ;; e. tar tgz archive b. * ) echo yes ;; c. lin? ) echo yes ;; 79. Which of the following could you use as options for the tar command to extract a gzip-compressed archive? d. [linus] | [LINUS] ) echo yes ;; e. (*nus echo yes ;; a. -czf b. ezf c. -tgz d. egf e. xzf 87. Which command sequence correctly searches for the string and then prints OK 80. To resume a stopped process as a foreground job, using Job Control, where N is the if it is found inside the password file? job number of the process and PID is its process ID, you would type a. if test string /etc/passwd ; then echo OK ; fi a. bg N b. fg %PID c. bg %PID b. if grep string /etc/passwd ; then echo OK ; fi d. fg %N e. bg PID c. if [ test string /etc/passwd ] ; then echo OK ; fi 81. Which of these statements is true? d. if [ grep string /etc/passwd ] ; then echo OK ; fi a. To indicate End-of-File (no more input) to a program, type [CONTROL]-[D]. e. if test string = /etc/passwd ; then echo OK ; fi b. To interrupt a Unix process from the keyboard, type [CONTROL]-[D]. 88. Which of the following commands would you use to resize an ext4 file system to c. To erase an entire line of typing, type [ALT]-[DELETE]. consume the remaining free space on its volume? d. The file command creates a new, empty file in the current directory a. resize2fs b. fsck.ext4 c. fsck e. Command apropos is an exact synonym for command man. d. mkfs.ext4 e. mkfs 82. To find out whether the httpd service was running, you could use which of the 89. If a shell script named foo contains the line: following commands? if [ '$3' = "$2" ] ; then echo SAME ; fi a. chkconfig httpd on then which of the following command lines will always produce SAME as output? b. service chkconfig httpd a. ./foo $1 $2 $3 b. ./foo 1 '$3' 2 c. chkconfig httpd status c. ./foo $1 '$2' $3 d. ./foo $3 "$2" $1 d. chkservice httpd e. ./foo '$1' "$3" $2 e. service httpd status 90. What is the output on your screen of this command line: 83. Which of the following commands would you use to install the httpd software echo hi | sed -e 's/HI/HO/' package apache (and its dependencies) on your CentOS virtual machine? a. ho b. HI a. yum install httpd b. pkginst httpd c. no output on screen d. HO c. install pkg httpd d. pkg -i httpd e. hi e. yum -i httpd 91. In a shell script, which of the following will cause the script to print enter: and 84. What is the output of the following sequence of bash commands: read what the user types into the variable input? echo '$foo' | sed -e 's/$/bar/' a. read >enter: enter: input< e. no output on screen CST 8177 − Winter 2015 − Practice Pool #2 Wenjuan Jiang & Ian Allen CST 8177 − Winter 2015 − Practice Pool #2 Wenjuan Jiang & Ian Allen 156 M/C Questions -13- 156 M/C Questions -14- 92. If guru=linus then which one of the following case patterns will match this 98. If a script named bar contains a loop that starts: statement: case "$guru" in for i in "$@" ; do a. guru ) echo yes ;; and the script is executed using this command line: b. "linu?" ) echo yes ;; ./bar 0 ' 1 2 ' 3 4 " 5 6 " c. [linus] | [LINUS] ) echo yes ;; how many times will the loop iterate? d. l?nus ) echo yes ;; a. 6 iterations b. 7 iterations c. 1 iteration e. lin? ) echo yes ;; d. 8 iterations e. 5 iterations 93. A shell script named foo is executed as follows: ./foo 1 2 "3 4" 5 99. If the current directory contains files abc, bbc, cbc, and bbc contains just the line Inside the script is the line: echo "$3" dbd, what is the output of the following command: grep 'bb*' bbc What is the output on your screen from this line? a. dbd b. an error message c. bbc a. $3 b. 2 3 4 c. 1 2 3 d. no output e. cbc d. 3 4 e. "3 100. In a shell script, which of the following will cause the script to stop and wait until 94. A crontab entry of 5 6 * * * /bin/somecommand the user enters something at the keyboard? would run somecommand when and how often? a. &1 >foo b. ls -l 2>$1 >foo e. at 5:06am every business day c. ls -l >foo 2>$1 d. ls -l >foo 2>&1 95. What is the output of the following sequence of bash commands: e. ls -l >foo 2>foo echo '$rich' | sed -e 's/$/bar/g' 102. In a shell script, which of the following would result in in the expansion of the a. barrichbar b. $richbar positional parameter representing the third argument without processing any special c. barrich d. bar$rich characters inside the expansion? e. no output on screen a. "\$3" b. $3 c. \$3 96. Which of the following commands would be used to add the user user001 to the d. "$3" e. '$3' group common? 103. If a shell script myscript.sh is called this way: a. usrgrp user001 common ./myscript.sh a b c b. groupadd -a common user001 and the first line inside the script below the script header is c. gpasswd -a user001 common shift; echo "$#$1" d. groupmod -a user001 common what is the output of that line? e. useradd user001 common a. 2a b. 2b c. 3a d. 4c e. 3b 97. Which of the following would best describe the ordering of levels in Logical 104. Which of the following mount options is one of the set of defaults? Volume Management (LVM), from bottom to top? a. remount b. user c. noauto a. logical volume, physical volume, file system, volume group d. rw e. bind b. physical volume, volume group, logical volume, file system 105. What command would you use to see the command that at job number 2 will run? c. volume group, logical volume, physical volume, file system a. at -l 2 b. at -v 2 c. at -m 2 d. physical volume, logical volume, file system, volume group d. at -c 2 e. atq 2 e. volume group, physical volume, file system, logical volume CST 8177 − Winter 2015 − Practice Pool #2 Wenjuan Jiang & Ian Allen CST 8177 − Winter 2015 − Practice Pool #2 Wenjuan Jiang & Ian Allen 156 M/C Questions -15- 156 M/C Questions -16- 106. A shell script named bar is executed as follows: 114. If a script named bar contains a loop that starts: ./bar "a b" "c d e" f for i in "$*" ; do Inside the script is the line: echo "$2" and the script is executed using this command line: What is the output on your screen from this line? ./bar 0 ' 1 2 ' 3 4 " 5 6 " a. $2 b. b" c. b how many times will the loop iterate? d. c d e e. a b a. 8 iterations b. 6 iterations c. 1 iteration 107. A crontab entry of 0 6 * * * /sbin/somescript d. 7 iterations e. 5 iterations would run somescript when and how often? 115. If you have a shell script named myscript that should run daily as root which a. at 12:06am every day command would you be more likely to run? b. at 12:06am every business day a. cp myscript /etc/cron.daily c. at 6:00am every day b. crontab < myscript d. at 12:06am every business day and Saturday c. crontab -e myscript e. at 6:00am every business day d. crontab -l myscript 108. In the /etc/suoders file, what word goes in front of ALL=(ALL) ALL to e. cp myscript /var/spool/cron allow the user admin to run commands as root? 116. Which line below puts the count of the number of lines in the password file into the a. %admin b. wheel c. #admin variable count? d. admin e. sudoers a. count=$( awk -F: /etc/passwd | wc -l ) 109. Which of the following is not an attribute of a Unix/Linux process: b. count=$( wc -l /etc/passwd | awk "print $1" ) a. Effective Group ID b. CPU identifier c. count=$( cat -c /etc/passwd ) c. Effective User ID d. Parent Process ID d. count=$( wc /etc/passwd | awk echo $1 ) e. Process ID e. count=$( wc -l /etc/sudoers d. 1 iteration e. 9 iterations c. vi /etc/sudoers d. visudo 119. Which of the following commands could be used to force the user user001 to e. nano /etc/sudoers change their password the next time they log in? 113. If a shell script named foo contains the line: a. force -d 0 user001 b. passwd -d 0 user001 if [ '$3' = "$2" ] ; then echo SAME ; fi c. gpasswd user001 d. chage -d 0 user001 then which of the following command lines will always produce SAME as output? e. passwd user001 a. ./foo 2 '$3' 1 b. ./foo '$1' "$3" $2 120. If a script named bar contains a loop that starts: c. ./foo $1 '$2' $3 d. ./foo $1 $2 $3 for i in "$*" ; do e. ./foo $3 "$2" $1 and the script is executed using this command line: ./bar a ' b d ' e f " g h " a how many times will the loop iterate? a. 9 iterations b. 7 iterations c. 1 iteration d. 8 iterations e. 6 iterations CST 8177 − Winter 2015 − Practice Pool #2 Wenjuan Jiang & Ian Allen CST 8177 − Winter 2015 − Practice Pool #2 Wenjuan Jiang & Ian Allen 156 M/C Questions -17- 156 M/C Questions -18- 121. What would the following command do: at 4pm 129. Fill in the blanks. If you try to ______ a filesystem, and the command fails, you a. read commands from stdin to be run once at 4pm might use the _____ command to look for the cause. b. run the user’s crontab jobs every day at 4pm a. umount, fuser b. fsck, rmdir c. issue an error message c. mkfs, mkdir d. mount, rm d. run the user’s crontab jobs at 4pm e. mount, mkfs e. read commands from stdin to be run every day at 4pm 130. Inside a bash shell script, which of the following would expand to the name of the 122. Inside a bash shell script, which of the following would expand to the exit status of script itself? the last command? a. "$*" b. "$#" c. "$?" d. "$@" e. "$0" a. "$?" b. "$*" c. "$#" d. "$@" e. "$0" 131. Which of the following commands would you use to start the httpd daemon, if 123. Which of the following PATH statements makes the most sense? you had just installed it and if it were not already running? a. PATH=/dev/null:/usr/bin:/etc:/bin a. httpd service on b. chkconfig httpd on b. PATH=/bin:/bin/cat:/usr/bin c. service httpd start d. kill -SIGSTART httpd c. PATH=/bin/ls:/etc:/usr/bin e. go httpd d. PATH=/dev:/bin:/usr/bin:/etc 132. Which of the following signals cannot be handled or ignored? e. PATH=/bin:/usr/bin:/etc/passwd a. SIGINT b. SIGKILL c. SIGHUP 124. Which command on a Unix/Linux system would you use to run a tar command at d. SIGTERM e. SIGSUSP a less urgent scheduling priority to let other processes with a more urgent 133. The cron system can run commands at most every scheduling priority run first? a. day b. second c. minute a. tar -10 b. nice c. fg d. hour e. millisecond d. tar -n e. bg 134. If the current directory contains files abc, bbc, cbc, and bbc contains just the line 125. A shell script named bar is executed as follows: dbd, what is the output of the following command: grep bb* bbc ./bar a "b c" 'a ' a. bbc b. an error message c. dbd Inside the script is the line: head $@ d. cbc e. no output How many arguments are passed to the head command inside the script? a. 2 b. 3 c. 6 d. 4 e. 5 135. What would be the output of the following command line: echo a b c d | awk '{print NF}' 126. Which of the following options for bash or sh might useful for debugging a shell a. NF b. a b c d c. no output script? d. 4 e. d a. -r b. -v c. -c d. -z e. -l 136. Fill in the blanks. If you try to ______ a filesystem, and the command fails, you 127. If the line, exit 3 might use the _____ command to look for the cause. is executed in a shell script, what is the result? a. mount, mkfs b. fsck, rm a. termination with an exit status of 3 c. umount, mkdir d. mkfs, rmdir b. an invalid argument error message e. mount, fsck c. termination with an exit status of 0 d. the script breaks out of up to 3 levels of loops 137. Which of the following commands would allow a properly configured user to type their own password to become root with an environment set up as if they had e. termination after sleeping for 3 seconds logged in as root? 128. If a script named bar contains a loop that starts: for i do a. su b. sudo c. sudo -s and the script is executed using this command line: d. su - e. sudo -i ./bar a ' b d ' e f " g h " how many times will the loop iterate? a. 1 iteration b. 7 iterations c. 8 iterations d. 6 iterations e. 5 iterations CST 8177 − Winter 2015 − Practice Pool #2 Wenjuan Jiang & Ian Allen CST 8177 − Winter 2015 − Practice Pool #2 Wenjuan Jiang & Ian Allen 156 M/C Questions -19- 156 M/C Questions -20- 138. Which command sequence correctly compares the numbers and prints OK? 145. Which of these statements is true? a. if [ ! 2 < 1 ] ; then echo OK ; fi a. The ls dir command looks up the directory argument dir in your $PATH . b. if ( 1 let 2 ) ; then echo OK ; fi b. If /q is an empty directory, echo /q/.* produces an error message. c. if [ 2 > 1 ] ; then echo OK ; fi c. If /p is an empty directory, ls /p/.* produces an error message. d. if ( let 2 > 1 ) ; then echo OK ; fi d. Typing ./script and bash script always give identical results. e. if [ 1 -lt 2 ] ; then echo OK ; fi e. Either single or double quotes will stop shell GLOB (wildcard) patterns from 139. Assuming you are not currently root and are a sudoer, which of the following expanding. commands could you use to simulate a full login as user100 without knowning 146. If foo is a directory that contains only the file bar and /dir1 is an empty their password? directory, what is in /dir1 after running the following command? a. sudo user100 b. sudo su - user100 rsync -avH foo /dir1 c. su - user100 d. su sudo user100 a. dir1 b. bar c. nothing e. sudo - user100 d. a symlink to foo e. foo 140. Which command would appear in your .bash_profile file? 147. Which of these statements is true? a. cat .bashrc b. source .bash_profile a. you can only make links to files owned by you c. source ./.bashrc d. .bash_profile source b. you can only remove a file name if the file is writable by you e. .bashrc source c. you can only remove a file name if the file is owned by you 141. Which command sequence correctly compares the two numbers and prints OK? d. you may be able to rename a file even if you do not own the file a. if [ 4 -gt 3 ] ; then echo OK ; fi e. you can change the permissions of any file to which you can write b. if ( let 4 > 3 ) ; then echo OK ; fi 148. Which of the following commands would you use to install the fortune software c. if [ 4 > 3 ] ; then echo OK ; fi package (and its dependencies) on your CentOS virtual machine? d. if [ ! 4 <= 3 ] ; then echo OK ; fi a. install pkg fortune b. pkginst fortune e. if ( ! 4 < 3 ) ; then echo OK ; fi c. yum install fortune d. pkg -i fortune 142. If variable mt might contain nothing (a null value - defined but empty), which e. yummy fortune command sequence correctly tests for this and prints OK? 149. Which of the following bash PATH statements makes the most sense? a. if [ "$mt" = "" ] ; then echo OK ; fi a. PATH=/bin:/usr/bin:/etc b. if [ "$mt" = * ] ; then echo OK ; fi b. PATH=/bin:/bin/cat:/usr/bin c. if [ $mt -eq "" ] ; then echo OK ; fi c. PATH=/bin/ls:/etc:/usr/bin d. if [ ''$mt'' = '''' ] ; then echo OK ; fi d. PATH=/bin:/usr/bin:/etc/passwd e. if [ $mt -eq : ] ; then echo OK ; fi e. PATH=/bin/sh:/usr/bin:/etc:/bin 143. If a shell script named foo contains the line: 150. In the /etc/suoders file, what word goes in front of ALL=(ALL) ALL to if [ '$1' = "$2" ] ; then echo SAME ; fi allow members of the group admin to run commands as root? then which of the following command lines will produce SAME as output? a. #admin b. %sudoers c. sudoers a. ./foo bar 'bar' b. ./foo bar '$1' d. admin e. %admin c. ./foo $1 $1 d. ./foo 1 "$1" 151. In a shell case structure, the case segment that will GLOB match the text a, b, e. ./foo 'bar' "bar" or c, is coded as 144. If the file foo in the current directory contains just two lines dbd, and 123, what is a. a|b|c ) b. a/b/c ) c. a\b\c ) the output of the following command: grep '[:alnum]' foo d. a,b,c ) e. a:b:c ) a. dbd b. no output c. an error message 152. Inside a bash shell script, which of the following would expand to all of the d. 123 e. foo arguments that were passed to the script, each as a separate word? a. "$#" b. "$0" c. "$*" d. "$?" e. "$@" CST 8177 − Winter 2015 − Practice Pool #2 Wenjuan Jiang & Ian Allen CST 8177 − Winter 2015 − Practice Pool #2 Wenjuan Jiang & Ian Allen 156 M/C Questions -21- 156 M/C Questions -22- 153. Which of the following PATH statements makes the most sense? This page intentionally left blank. a. PATH=/bin/sh:/usr/bin:/etc:/bin b. PATH=/bin:/bin/cat:/usr/bin c. PATH=/etc:/usr/bin:/bin d. PATH=/bin/ls:/etc:/usr/bin e. PATH=/bin:/usr/bin:/etc/passwd 154. Which line below puts the count of the number of lines in the password file into the variable foo? a. foo=$( wc /etc/passwd | awk echo $1 ) b. foo=$( wc -l