Deck 6: Introduction to Shell Script Programming

Full screen (f)
exit full mode
Question
The ____ command prints a listing of environment and configuration variables.

A)printenv
B)printvar
C)printf
D)bash
Use Space or
up arrow
down arrow
to flip the card.
Question
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 (< >)
Question
In shell scripts,comment lines begin with a(n)____.

A)tilde (~)character
B)dollar ($)sign
C)pound (#)symbol
D)exclamation (!)sign
Question
The ____ shell,when compared to the other shells,has a more powerful programming interface.

A)Bourne
B)Bash
C)C
D)Korn
Question
A program's high-level language statements are stored in a file called the ____ file.

A)shell
B)script
C)program
D)source
Question
Shell scripts run more quickly than compiled programs.
Question
Shell scripts can automatically access variables created and assigned on the command line.
Question
If a source file contains ____ errors,it cannot be converted into an executable file.

A)syntax
B)debugging
C)compilation
D)logic
Question
The Bash shell offers improved features over the older Bourne and Korn shells and is fully backward compatible with the Bourne shell.
Question
You use the chexec command to indicate that a (shell script)file can be executed.
Question
You should omit spaces when you assign a variable without using single or double quotation marks around its value.
Question
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
Question
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
Question
The UNIX-Linux shell acts as a(n)____ when reading script files.

A)compiler
B)interpreter
C)assembler
D)linker
Question
____ 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
Question
Logic structures are also called ____ structures.

A)decision
B)sequential
C)control
D)programming
Question
____ gives the owner read,write,and execute permissions.

A)chmod 155
B)chmod 551
C)chmod 577
D)chmod 755
Question
____ variables are those you create at the command line or in a shell script.

A)Global
B)Environment
C)Configuration
D)Shell
Question
A high-level language is a computer language that uses English-like expressions.
Question
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
Question
The ____ statement simplifies the selection of a match when you have a list of choices.

A)if
B)switch
C)case
D)while
Question
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
Question
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.
Question
The ____________________ shell is similar to the Bash shell in many respects,but has syntax similar to that of C programming.
Question
You use the ____________________ command to loop through a range of values.
Question
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
Question
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
Question
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
Question
The ____________________ command,used to run a shell script,includes several options for debugging.
Question
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
Question
Logic structures supported by shell scripts include: sequential logic,decision logic,looping logic,and ____________________ logic.
Question
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
Question
____ operators compare the relationship between two values or arguments.

A)Evaluation
B)Comparison
C)Logical
D)Relational
Question
With no options,____ displays the current listing of Bash environment and shell script variables.

A)let
B)set
C)sh
D)export
Question
Wildcard characters are also known as ____ characters.

A)bogus
B)filler
C)glob
D)search
Question
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
Question
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
Question
____________________ are text files that contain sequences of UNIX-Linux commands.
Question
____________________ operators are used to assign a value to a variable.
Question
The ____________________ variable provides a list of directory locations where UNIX or Linux looks to find executable scripts or programs.
Question
What is an algorithm?
Question
What is a string variable?
Question
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
Question
What are shell variables?
Question
What is a glob pattern?
Question
What is looping logic?
Question
What is a branch instruction?
Question
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
Question
What is debugging?
Question
What is the back quote operator (`)used for?
Question
What is the program development cycle?
Question
What is an operand?
Question
What is a prototype?
Question
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
Question
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
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/55
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
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
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 (< >)
B
3
In shell scripts,comment lines begin with a(n)____.

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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 55 flashcards in this deck.