In this chapter, we examined basic command syntax and text processing using the sed and awk utilities. While many administrators use perl for automating tasks and performing pattern matching, many sed and awk scripts are still in use and administrators should ensure they can edit and modify them where necessary.
1. |
What is the logical result of the test “-n str”?
|
|
2. |
What is the logical result of the test “str”?
|
|
3. |
What is the logical result of the test “str1 != str2”?
|
|
4. |
What is the logical result of the test “-z str”?
|
|
5. |
What is the logical result of the test “a –eq b”?
|
|
6. |
What is the logical result of the test “a –ge b”?
|
|
7. |
What is the logical result of the test “a –gt b”?
|
|
8. |
What is the logical result of the test “a –le b”?
|
|
9. |
What is the logical result of the test “-b file”?
|
|
10. |
What is the logical result of the test “-c file”?
|
|
11. |
What is the logical result of the test “-d file”?
|
|
12. |
What is the logical result of the test “-f file”?
|
|
13. |
What is the logical result of the test “-p file”?
|
|
14. |
What is the logical result of the test “-s file”?
|
|
15. |
What is the logical result of the test “-w file”?
|
|
Answers
1. |
D. The logical result of the test “-n str” is true if and only if the string str has nonzero length. |
2. |
C. The logical result of the test “str” is true if and only if the string str is non-null. |
3. |
B. The logical result of the test “str1 != str2 is true if and only if the characters comprising the string str1 are not identical and in the same order as the characters comprising the string str2. |
4. |
A. The logical result of the test “-z str” is true if and only if the string str has zero length. |
5. |
D. The logical result of the test “a –eq b” is true if and only if a is equal to b. |
6. |
C. The logical result of the test “a –ge b” is true if and only if a is greater than or equal to b. |
7. |
B. The logical result of the test “a –gt b” is true if and only if a is greater than b. |
8. |
A. The logical result of the test “a –le b” is true if and only if a is less than or equal to b. |
9. |
A. The logical result of the test “-b file” is true if and only if file is a special block file. |
10. |
B. The logical result of the test “-c file” is true if and only if file is a special character file. |
11. |
C. The logical result of the test “-d file” is true if and only if file is a directory. |
12. |
D. The logical result of the test “-f file” is true if and only if file is a normal file. |
13. |
A. The logical result of the test “-p file” is true if and only if file is a named pipe. |
14. |
B. The logical result of the test “-s file” is true if and only if file has nonzero size. |
15. |
C. The logical result of the test “-w file” is true if and only if file is writable by the current user. |