Networking Chapter 6 1 environment variable that identifies the path name for user’s home directory

subject Type Homework Help
subject Pages 7
subject Words 1186
subject Authors Michael Palmer

Unlock document.

This document is partially blurred.
Unlock all pages and 1 million more documents.
Get Access
page-pf1
CHAPTER 6: INTRODUCTION TO SHELL SCRIPT PROGRAMMING
TRUE/FALSE
1. A high-level language is a computer language that uses English-like expressions.
2. You use the chexec command to indicate that a (shell script) file can be executed.
3. Shell scripts run more quickly than compiled programs.
4. The Bash shell offers improved features over the older Bourne and Korn shells and is fully backward
compatible with the Bourne shell.
5. You should omit spaces when you assign a variable without using single or double quotation marks
around its value.
6. Shell scripts can automatically access variables created and assigned on the command line.
MULTIPLE CHOICE
1. A ____ is a name consisting of letters, numbers, or characters and is used to reference the contents of a
variable.
a.
comment
c.
label
b.
symbolic name
d.
tag
2. Logic structures are also called ____ structures.
a.
decision
c.
control
b.
sequential
d.
programming
3. A program’s high-level language statements are stored in a file called the ____ file.
a.
shell
c.
program
b.
script
d.
source
4. The ____ reads the lines of code that the programmer wrote in the source file and converts them to the
appropriate machine-language instructions.
page-pf2
a.
compiler
c.
assembler
b.
linker
d.
interpreter
5. If a source file contains ____ errors, it cannot be converted into an executable file.
a.
syntax
c.
compilation
b.
debugging
d.
logic
6. The UNIX/Linux shell acts as a(n) ____ when reading script files.
a.
compiler
c.
assembler
b.
interpreter
d.
linker
7. ____ gives the owner read, write, and execute permissions.
a.
chmod 155
c.
chmod 577
b.
chmod 551
d.
chmod 755
8. In shell scripts, comment lines begin with a(n) ____.
a.
tilde (~) character
c.
pound (#) symbol
b.
dollar ($) sign
d.
exclamation (!) sign
9. The ____ shell, when compared to the other shells, has a more powerful programming interface.
a.
Bourne
c.
C
b.
Bash
d.
Korn
10. ____ variables are used to store information about the setup of the operating system, and after they are
set up, you typically do not change them.
a.
Global
c.
Configuration
b.
Environment
d.
Shell
11. ____ variables are those you create at the command line or in a shell script.
a.
Global
c.
Configuration
b.
Environment
d.
Shell
12. The ____ command prints a listing of environment and configuration variables.
a.
printenv
c.
printf
b.
printvar
d.
bash
13. To reference a variable, you use a dollar sign ($) in front of it or enclose it in ____.
a.
square brackets ([ ])
c.
double quotes (“ ”)
b.
curly brackets ({ })
d.
angle brackets (< >)
page-pf3
14. When you assign a value to a variable, you might want to evaluate it by displaying its contents via a(n)
____ operator.
a.
definition
c.
evaluating
b.
echo
d.
print
15. ____ operators compare the relationship between two values or arguments.
a.
Evaluation
c.
Logical
b.
Comparison
d.
Relational
16. With no options, ____ displays the current listing of Bash environment and shell script variables.
a.
let
c.
sh
b.
set
d.
export
17. Wildcard characters are also known as ____ characters.
a.
bogus
c.
glob
b.
filler
d.
search
18. The ____ statement continues to loop and execute commands or statements as long as a given
condition or set of conditions is true.
a.
for
c.
esac
b.
while
d.
case
19. The ____ statement simplifies the selection of a match when you have a list of choices.
a.
if
c.
case
b.
switch
d.
while
20. The ____ command enables you to initialize the terminal display or terminal window, to place text and
prompts in desired locations, and to respond to what the user selects from the menu.
a.
put
c.
clear
b.
tput
d.
tclear
21. The ____ command is useful when you want your shell program to automatically remove any
temporary files that are created when the shell script runs.
a.
set
c.
tput
b.
export
d.
trap
COMPLETION
page-pf4
1. Shell scripts support many shell script ____________________, including those for assigning the
contents of a shell variable, for evaluating information, for performing mathematical operations, and
for piping or redirection of input/output.
2. Logic structures supported by shell scripts include: sequential logic, decision logic, looping logic, and
____________________ logic.
3. ____________________ are text files that contain sequences of UNIX/Linux commands.
4. The ____________________ variable provides a list of directory locations where UNIX or Linux
looks to find executable scripts or programs.
5. The ____________________ shell is similar to the Bash shell in many respects, but has syntax similar
to that of C programming.
6. ____________________ operators are used to assign a value to a variable.
7. You use the ____________________ command to loop through a range of values.
8. The ____________________ command, used to run a shell script, includes several options for
debugging.
page-pf5
MATCHING
Match each item with a statement below.
a.
!
f.
SHELL
b.
?
g.
PATH
c.
ENV
h.
~
d.
PS1
i.
BASH
e.
HOME
1. environment variable that identifies the path name for user’s home directory
2. environment variable that holds the path name of the program for the type of shell you are using
3. environment variable that contains the absolute path to the Bash shell, such as /bin/bash
4. environment variable that holds the primary shell prompt
5. environment variable that contains the file name containing commands to initialize the shell
6. environment variable that holds the list of path names for directories searched for executable
commands
7. bitwise negation operator
8. logical negation operator
9. matches exactly one character, except for the backslash and period
SHORT ANSWER
1. What are shell variables?
2. What is the program development cycle?
page-pf6
3. What is an algorithm?
4. What is debugging?
5. What is a prototype?
6. What is a string variable?
7. What is an operand?
8. What is the back quote operator (`) used for?
9. What is a glob pattern?
page-pf7
10. What is a branch instruction?
11. What is looping logic?

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.