Basic Unix shell script Test
1. Which of the following code lines will print your previous working directory to the screen? C
A. Echo ~
B. Echo $ pwd
C. Echo ~ -
D. Echo *
2. Which of the following symbols can be used to redirect the command output to a file? If the file exists, the file will be overwritten? C
A.>
B. <-
C.>
D. n>
3. Which of the following statements enables shell to run the pkgsetup script at pm on April 9, January 10? C
A. pkgsetup at PM Jan 10
B. cron pkgsetup PM Jan 10
C. At PM Jan 10 pkgsetup
D. Batch 5: 30 pm Jan 10 pkgsetup
4. Which of the following replacement symbols will return the path of your previous working directory? A
A ,~ -
B ,??
C ,*
D, $ ()
5. What operations does the following code perform? Ls catalog & sort catalog
A. If the directory file exists, run the sort command.
B. If the directory file does not exist, run the sort command.
C. Run the LS and sort commands in the background.
D. Run the LS and sort commands in subshell.
6. Which of the following symbols can be used as the command separator? B
A ,/
B ,;
C ,/
D ,?
7. Which of the following code statements can be executed by the Creator and users in the same group of pkgsetup scripts, but cannot be viewed by all other users? C
A. chmod + x-o pkgsetup
B. chmod 775 pkgsetup
C. chmod 770 pkgsetup
D. chmod XX-pkgsetup
8. Which of the following code lines will run the script named myscript. Sh in the background? C
A./background/myscript. Sh
B../myscript. Sh &&
C,./myscript. Sh &
D../myscript. Sh background
9. Which type of brackets can you use to enclose commands when executing command replacement? A
A ,()
B. []
C ,{}
D. <>
10. Which of the following shells do not support editing command lines in VI and Emacs modes? B
A, TC
B. Bourne
C. Bash
D. Korn
Your score for this test is correct for 10 questions. Pass the test