Summary

Summary

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.

Questions

1. 

What is the logical result of the test “-n str”?

  1. Is true if and only if the string str has zero length.

  2. 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.

  3. Is true if and only if the string str is non-null.

  4. Is true if and only if the string str has nonzero length.

 D. The logical result of the test  -n str  is true if and only if the string str has nonzero length.

2. 

What is the logical result of the test “str”?

  1. Is true if and only if the string str has zero length.

  2. 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.

  3. Is true if and only if the string str is non-null.

  4. Is true if and only if the string str has nonzero length.

 C. The logical result of the test  str  is true if and only if the string str is non-null.

3. 

What is the logical result of the test “str1 != str2”?

  1. Is true if and only if the string str has zero length.

  2. 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.

  3. Is true if and only if the string str is non-null.

  4. Is true if and only if the string str has nonzero length.

 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. 

What is the logical result of the test “-z str”?

  1. Is true if and only if the string str has zero length.

  2. 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.

  3. Is true if and only if the string str is non-null.

  4. Is true if and only if the string str has nonzero length.

 A. The logical result of the test  -z str  is true if and only if the string str has zero length.

5. 

What is the logical result of the test “a –eq b”?

  1. Is true if and only if a is less than or equal to b.

  2. Is true if and only if a is greater than b.

  3. Is true if and only if a is greater than or equal to b.

  4. Is true if and only if a is equal to b.

 D. The logical result of the test  a  eq b  is true if and only if a is equal to b.

6. 

What is the logical result of the test “a –ge b”?

  1. Is true if and only if a is less than or equal to b.

  2. Is true if and only if a is greater than b.

  3. Is true if and only if a is greater than or equal to b.

  4. Is true if and only if a is equal to b.

 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. 

What is the logical result of the test “a –gt b”?

  1. Is true if and only if a is less than or equal to b.

  2. Is true if and only if a is greater than b.

  3. Is true if and only if a is greater than or equal to b.

  4. Is true if and only if a is equal to b.

 B. The logical result of the test  a  gt b  is true if and only if a is greater than b.

8. 

What is the logical result of the test “a –le b”?

  1. Is true if and only if a is less than or equal to b.

  2. Is true if and only if a is greater than b.

  3. Is true if and only if a is greater than or equal to b.

  4. Is true if and only if a is equal to b.

 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. 

What is the logical result of the test “-b file”?

  1. Is true if and only if file is a special block file.

  2. Is true if and only if file is a special character file.

  3. Is true if and only if file is a directory.

  4. Is true if and only if file is a normal file.

 A. The logical result of the test  -b file  is true if and only if file is a special block file.

10. 

What is the logical result of the test “-c file”?

  1. Is true if and only if file is a special block file.

  2. Is true if and only if file is a special character file.

  3. Is true if and only if file is a directory.

  4. Is true if and only if file is a normal file.

 B. The logical result of the test  -c file  is true if and only if file is a special character file.

11. 

What is the logical result of the test “-d file”?

  1. Is true if and only if file is a special block file.

  2. Is true if and only if file is a special character file.

  3. Is true if and only if file is a directory.

  4. Is true if and only if file is a normal file.

 C. The logical result of the test  -d file  is true if and only if file is a directory.

12. 

What is the logical result of the test “-f file”?

  1. Is true if and only if file is a special block file.

  2. Is true if and only if file is a special character file.

  3. Is true if and only if file is a directory.

  4. Is true if and only if file is a normal file.

 D. The logical result of the test  -f file  is true if and only if file is a normal file.

13. 

What is the logical result of the test “-p file”?

  1. Is true if and only if file is a named pipe.

  2. Is true if and only if file has nonzero size.

  3. Is true if and only if file is writable by the current user.

  4. Is true if and only if file is executable by the current user.

 A. The logical result of the test  -p file  is true if and only if file is a named pipe.

14. 

What is the logical result of the test “-s file”?

  1. Is true if and only if file is a named pipe.

  2. Is true if and only if file has nonzero size.

  3. Is true if and only if file is writable by the current user.

  4. Is true if and only if file is executable by the current user.

 B. The logical result of the test  -s file  is true if and only if file has nonzero size.

15. 

What is the logical result of the test “-w file”?

  1. Is true if and only if file is a named pipe.

  2. Is true if and only if file has nonzero size.

  3. Is true if and only if file is writable by the current user.

  4. Is true if and only if file is executable by the current user.

 C. The logical result of the test  -w file  is true if and only if file is writable by the current user.

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.



Part I: Solaris 9 Operating Environment, Exam I