Networking Chapter 7 1 If you are using the Bash shell, what scripts are run automatically when you log in

subject Type Homework Help
subject Pages 6
subject Words 1252
subject Authors Michael Palmer

Unlock document.

This document is partially blurred.
Unlock all pages and 1 million more documents.
Get Access
page-pf1
CHAPTER 7: ADVANCED SHELL PROGRAMMING
TRUE/FALSE
1. The program development cycle begins with creating specifications for a program.
2. After creating a flowchart, the next step in designing a program is to write the program code.
3. Pseudocode is a design tool only, and is never processed by the computer.
4. In UNIX/Linux, all shells support the same commands and programming statements.
5. A .bash_logout file in each Bash user’s home directory executes commands when the user logs out.
MULTIPLE CHOICE
1. The second step in the program development cycle is ____.
a.
creating program specifications
c.
the design process
b.
coding the program
d.
debugging
2. A ____ is a logic diagram that uses a set of standard symbols to visually explain the sequence of
events from the start of a process to its end point.
a.
flowchart
c.
block chart
b.
map
d.
pseudocode
3. Each step in the program is represented by a(n) ____ in the flowchart.
a.
block
c.
label
b.
arrow
d.
symbol
4. In a flowchart, a(n) ____ is used to represent a process.
a.
diamond
c.
circle
b.
rectangle
d.
arrow
5. In a flowchart, a(n) ____ is used to indicate process flow.
a.
diamond
c.
circle
page-pf2
b.
rectangle
d.
arrow
6. In a flowchart, a(n) ____ is an on-page connector to continue process flow.
a.
diamond
c.
circle
b.
rectangle
d.
arrow
7. In a flowchart, a(n) ____ is used to represent a decision.
a.
diamond
c.
circle
b.
rectangle
d.
arrow
8. When you create a script, you should include the command that sets the particular shell to use on ____.
a.
the configuration file
c.
the first line of the script
b.
your login script
d.
the last line of the script
9. The line in the script for setting the Bash shell is: ____.
a.
#!/bin/bash
c.
#/bin/bash
b.
!#/bin/bash
d.
!/bin/bash
10. For your own account, the shell that is set up by default is established by the system administrator in
the ____ file.
a.
/etc/shell
c.
/etc/shadow
b.
/etc/passwd
d.
/etc/default
11. Each record in the /etc/passwd file is simply a record with variable-length fields separated by ____.
a.
dashes (-)
c.
semicolons (;)
b.
commas (,)
d.
colons (:)
12. ____ is a multifunction tool that enables you to manage openSUSE from one location.
a.
User Manager
c.
Control Panel
b.
YaST
d.
MC
13. The .bashrc file is a hidden file contained in ____ directory.
a.
the root
c.
the /usr
b.
your home
d.
the /home
14. To view a list of the files in a directory, including the hidden files, you should enter ____.
a.
ls -l
c.
ls -h
b.
ls -r
d.
ls -a
page-pf3
15. The ____ file is run each time you log in or give the command to set Bash as your current shell, but
not when you run a subshell.
a.
.bash_profile
c.
.bashrc
b.
.bash
d.
.bash_login
16. The ____ file typically contains settings, such as environment variable settings, aliases, and other
settings that you always want in effect when you are in the Bash shell.
a.
.bash_profile
c.
.bashrc
b.
.bash
d.
.bash_login
17. The ____ file runs when you log in using the Bash shell as the default, and each time you start a Bash
shell within a Bash shell.
a.
.bash_profile
c.
.bashrc
b.
.bash
d.
.bash_login
18. The ____ operator of the test command, combines two expressions and tests a logical OR relationship
between them.
a.
|
c.
-O
b.
||
d.
-o
19. To format record output you can use the translate utility, ____.
a.
tr
c.
trans
b.
trns
d.
translate
20. A simple way to delete a record using ____ is with the -d (delete) option.
a.
awk
c.
test
b.
sed
d.
tr
21. A function name differs from a variable name because a function name is followed by a set of ____.
a.
parentheses
c.
square brackets
b.
curly brackets
d.
angle brackets
COMPLETION
1. ____________________ enable you to determine the type of data needed for input, the processes that
must be performed, and the output requirements.
page-pf4
2. Two popular and proven analysis tools are used to help you design your programs to meet the program
specifications: the flowchart and ____________________.
3. The ____________________ that connect the symbols in a flowchart represent the direction in which
the program flows.
4. ____________________ instructions are similar to actual programming statements.
5. The /____________________/bashrc file sets default functions and aliases.
6. You can define functions from the command line by first entering the name of the function and then
completing the ____________________ to define it.
MATCHING
Match each option of the test command with a statement below.
a.
-a
f.
-n
b.
!
g.
-nt
c.
-r
h.
-s
d.
-f
i.
-e
e.
-ne
1. performs a relational integer test
2. tests for a nonzero string length
3. true if a file exists
4. true if a file exists and is a regular file
5. compares the first file in the argument with the second file to determine if the first file is newer
6. true if a file exists and can be read
7. true if a file exists and its size is greater than zero
8. logical AND
9. logical negation
page-pf5
SHORT ANSWER
1. What are flowcharts used for?
2. What are pseudocode instructions used for?
3. If you are using the Bash shell, what scripts are run automatically when you log in?
4. How can you set defaults for using the vi editor?
5. What is the test command used for?
page-pf6
6. How can you view the most recent command’s exit status?
7. What is a Boolean operator?
8. The clear command is a useful housekeeping utility for clearing the screen, but you can use a faster
method. Describe this alternative method.
9. What does “input validation” mean?
10. What is a shell function?

Trusted by Thousands of
Students

Here are what students say about us.

Copyright ©2022 All rights reserved. | CoursePaper is not sponsored or endorsed by any college or university.