Operating Systems and Systems Integration Quiz 8: Shell Programming Do not refer to any printed material. No talking or discussion is allowed until the answer sheets are all collected. Review: 1. A shell script is written called rename. It can be called in any of the following ways: $ $ $ $ $ rename rename rename rename rename The ‘-v’, ‘-l’ are called: -v -v *.c -v *.c -v -l *.c (A) options (B) enumerations (C) test fields (D) parameters (E) param 2. This question relates to input and output in the shell: (A) We can perform input with read, output with printf (B) We can perform input with read, output with echo (C) We can never use a while loop with read to process input (D) We use redirection to put output into files (E) All the other choices are correct 3. Here are two arithmetic conditions that are to be used with an if statement: [ $i -lt 5 ] (A) Both are correct (B) The first is correct but the second is not because the ‘$’ is missing before the ‘i’ (C) The first is correct but the second is not because there should be spaces between the tokens (D) The first is correct but the second is not correct because the operator should be ‘-lt’ (E) The first is wrong, but the second is correct. Preparation: 4. A regular expression is: (A) A pattern used to match text (B) A method for organising data in columns (C) A way to sort data either numerically or alphabetically (D) A special mathematical expression that calculates regularly (i.e., in a loop) (E) An output statement that expresses formats regularly 5. awk is: (A) a programming language (B) a command useful for separating input data into columns (C) a command that matches patterns in text (D) supports regular expressions (E) automatically splits input data into fields ((i<5)) Nick Urbanik nicku(at)vtc.edu.hk ver. 1.0