Deck 6: Introduction to Shell Script Programming
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/55
Play
Full screen (f)
Deck 6: Introduction to Shell Script Programming
1
The ____ command prints a listing of environment and configuration variables.
A)printenv
B)printvar
C)printf
D)bash
A)printenv
B)printvar
C)printf
D)bash
A
2
To reference a variable,you use a dollar sign ($)in front of it or enclose it in ____.
A)square brackets ([ ])
B)curly brackets ({ })
C)double quotes (" ")
D)angle brackets (< >)
A)square brackets ([ ])
B)curly brackets ({ })
C)double quotes (" ")
D)angle brackets (< >)
B
3
In shell scripts,comment lines begin with a(n)____.
A)tilde (~)character
B)dollar ($)sign
C)pound (#)symbol
D)exclamation (!)sign
A)tilde (~)character
B)dollar ($)sign
C)pound (#)symbol
D)exclamation (!)sign
C
4
The ____ shell,when compared to the other shells,has a more powerful programming interface.
A)Bourne
B)Bash
C)C
D)Korn
A)Bourne
B)Bash
C)C
D)Korn
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
5
A program's high-level language statements are stored in a file called the ____ file.
A)shell
B)script
C)program
D)source
A)shell
B)script
C)program
D)source
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
6
Shell scripts run more quickly than compiled programs.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
7
Shell scripts can automatically access variables created and assigned on the command line.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
8
If a source file contains ____ errors,it cannot be converted into an executable file.
A)syntax
B)debugging
C)compilation
D)logic
A)syntax
B)debugging
C)compilation
D)logic
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
9
The Bash shell offers improved features over the older Bourne and Korn shells and is fully backward compatible with the Bourne shell.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
10
You use the chexec command to indicate that a (shell script)file can be executed.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
11
You should omit spaces when you assign a variable without using single or double quotation marks around its value.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
12
A ____ is a name consisting of letters,numbers,or characters and is used to reference the contents of a variable.
A)comment
B)symbolic name
C)label
D)tag
A)comment
B)symbolic name
C)label
D)tag
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
13
When you assign a value to a variable,you might want to evaluate it by displaying its contents via a(n)____ operator.
A)definition
B)echo
C)evaluating
D)print
A)definition
B)echo
C)evaluating
D)print
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
14
The UNIX-Linux shell acts as a(n)____ when reading script files.
A)compiler
B)interpreter
C)assembler
D)linker
A)compiler
B)interpreter
C)assembler
D)linker
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
15
____ 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
B)Environment
C)Configuration
D)Shell
A)Global
B)Environment
C)Configuration
D)Shell
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
16
Logic structures are also called ____ structures.
A)decision
B)sequential
C)control
D)programming
A)decision
B)sequential
C)control
D)programming
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
17
____ gives the owner read,write,and execute permissions.
A)chmod 155
B)chmod 551
C)chmod 577
D)chmod 755
A)chmod 155
B)chmod 551
C)chmod 577
D)chmod 755
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
18
____ variables are those you create at the command line or in a shell script.
A)Global
B)Environment
C)Configuration
D)Shell
A)Global
B)Environment
C)Configuration
D)Shell
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
19
A high-level language is a computer language that uses English-like expressions.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
20
The ____ reads the lines of code that the programmer wrote in the source file and converts them to the appropriate machine-language instructions.
A)compiler
B)linker
C)assembler
D)interpreter
A)compiler
B)linker
C)assembler
D)interpreter
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
21
The ____ statement simplifies the selection of a match when you have a list of choices.
A)if
B)switch
C)case
D)while
A)if
B)switch
C)case
D)while
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
22
Match each item with a statement below.
a.!
f.SHELL
b.?
g.PATH
c.ENV
h.~
d.PS1
i.BASH
e.HOME
environment variable that holds the primary shell prompt
a.!
f.SHELL
b.?
g.PATH
c.ENV
h.~
d.PS1
i.BASH
e.HOME
environment variable that holds the primary shell prompt
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
23
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.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
24
The ____________________ shell is similar to the Bash shell in many respects,but has syntax similar to that of C programming.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
25
You use the ____________________ command to loop through a range of values.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
26
Match each item with a statement below.
a.!
f.SHELL
b.?
g.PATH
c.ENV
h.~
d.PS1
i.BASH
e.HOME
environment variable that contains the file name containing commands to initialize the shell
a.!
f.SHELL
b.?
g.PATH
c.ENV
h.~
d.PS1
i.BASH
e.HOME
environment variable that contains the file name containing commands to initialize the shell
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
27
The ____ statement continues to loop and execute commands or statements as long as a given condition or set of conditions is true.
A)for
B)while
C)esac
D)case
A)for
B)while
C)esac
D)case
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
28
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
B)export
C)tput
D)trap
A)set
B)export
C)tput
D)trap
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
29
The ____________________ command,used to run a shell script,includes several options for debugging.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
30
Match each item with a statement below.
a.!
f.SHELL
b.?
g.PATH
c.ENV
h.~
d.PS1
i.BASH
e.HOME
environment variable that contains the absolute path to the Bash shell,such as -bin-bash
a.!
f.SHELL
b.?
g.PATH
c.ENV
h.~
d.PS1
i.BASH
e.HOME
environment variable that contains the absolute path to the Bash shell,such as -bin-bash
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
31
Logic structures supported by shell scripts include: sequential logic,decision logic,looping logic,and ____________________ logic.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
32
Match each item with a statement below.
a.!
f.SHELL
b.?
g.PATH
c.ENV
h.~
d.PS1
i.BASH
e.HOME
environment variable that identifies the path name for user's home directory
a.!
f.SHELL
b.?
g.PATH
c.ENV
h.~
d.PS1
i.BASH
e.HOME
environment variable that identifies the path name for user's home directory
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
33
____ operators compare the relationship between two values or arguments.
A)Evaluation
B)Comparison
C)Logical
D)Relational
A)Evaluation
B)Comparison
C)Logical
D)Relational
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
34
With no options,____ displays the current listing of Bash environment and shell script variables.
A)let
B)set
C)sh
D)export
A)let
B)set
C)sh
D)export
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
35
Wildcard characters are also known as ____ characters.
A)bogus
B)filler
C)glob
D)search
A)bogus
B)filler
C)glob
D)search
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
36
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
B)tput
C)clear
D)tclear
A)put
B)tput
C)clear
D)tclear
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
37
Match each item with a statement below.
a.!
f.SHELL
b.?
g.PATH
c.ENV
h.~
d.PS1
i.BASH
e.HOME
environment variable that holds the path name of the program for the type of shell you are using
a.!
f.SHELL
b.?
g.PATH
c.ENV
h.~
d.PS1
i.BASH
e.HOME
environment variable that holds the path name of the program for the type of shell you are using
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
38
____________________ are text files that contain sequences of UNIX-Linux commands.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
39
____________________ operators are used to assign a value to a variable.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
40
The ____________________ variable provides a list of directory locations where UNIX or Linux looks to find executable scripts or programs.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
41
What is an algorithm?
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
42
What is a string variable?
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
43
Match each item with a statement below.
a.!
f.SHELL
b.?
g.PATH
c.ENV
h.~
d.PS1
i.BASH
e.HOME
bitwise negation operator
a.!
f.SHELL
b.?
g.PATH
c.ENV
h.~
d.PS1
i.BASH
e.HOME
bitwise negation operator
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
44
What are shell variables?
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
45
What is a glob pattern?
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
46
What is looping logic?
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
47
What is a branch instruction?
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
48
Match each item with a statement below.
a.!
f.SHELL
b.?
g.PATH
c.ENV
h.~
d.PS1
i.BASH
e.HOME
matches exactly one character,except for the backslash and period
a.!
f.SHELL
b.?
g.PATH
c.ENV
h.~
d.PS1
i.BASH
e.HOME
matches exactly one character,except for the backslash and period
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
49
What is debugging?
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
50
What is the back quote operator (`)used for?
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
51
What is the program development cycle?
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
52
What is an operand?
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
53
What is a prototype?
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
54
Match each item with a statement below.
a.!
f.SHELL
b.?
g.PATH
c.ENV
h.~
d.PS1
i.BASH
e.HOME
logical negation operator
a.!
f.SHELL
b.?
g.PATH
c.ENV
h.~
d.PS1
i.BASH
e.HOME
logical negation operator
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
55
Match each item with a statement below.
a.!
f.SHELL
b.?
g.PATH
c.ENV
h.~
d.PS1
i.BASH
e.HOME
environment variable that holds the list of path names for directories searched for executable commands
a.!
f.SHELL
b.?
g.PATH
c.ENV
h.~
d.PS1
i.BASH
e.HOME
environment variable that holds the list of path names for directories searched for executable commands
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck