OS515-Workbook6-part2 Flashcards

1
Q

The bash shell expands certain command line metacharacters before…?

A

interpreting the command.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Tilde expansion expands tokens that begin with a…?

A

tilde (~) to users home directories.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Brace expansion expands tokens with …?

A

braces ({}) into multiple words, each of which contains a single word from the specified list.

mkdir {dir1,dir2,dir3}/{subdir1,subdir2}

mkdir dir1
mkdir dir1/subdir1
mkdir dir1/subdir2
…etc…

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Command substitution expands text enclosed within…?

A

backticks (‘’) or “dollar parenthesis” ($()) into the output produced by the enclosed command.

VAR=COMMAND

FILES=`ls /etc`
FILES=$(ls /etc)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
Pathname Expansion ("File Globbing")
Covered earlier and is also...?
A

a shell expansion.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Remember that expansion occurs before the program is…?

A

executed, so the program is given a set of matching files.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Pathname Expansion:

Character * match?

A

0 or more characters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Pathname Expansion:

Character ? match?

A

Exactly one characters.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Pathname Expansion:

Character […] match?

A

Exactly one of the included characters.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Pathname Expansion:

Character [^…]

A

Exactly one of the excluded characters.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

See slide 8 for…?

A

command line expansion subtleties.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

The bash shell internally implements certain simple commands which are closely related to the…?

A

to the shell’s behavior. These are referred to as builtin commands.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Shell aliases create apparent commands which…?

A

expand to arbitrary text.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

The bash shell prompt can be…?

A

customized using the PSI variable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Shell flags modify the …?

A

bash shell behavior.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Shell options offer more…?

A

bash shell configuration options.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Slide 11 shows…?

A

Slide Builtins.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Slide 12 shows…?

A

Aliases

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Running commands.

A

Perform any shell expansions
v
Expand any aliases
v
If command is shell function, run the function.
v
If the command is built-in run it.
v
if the command is absolute run it (if allowed and exists)
v
Search PATH for command if allowed run it.

20
Q

PS1…?

A

Default prompt.

21
Q

PS2…?

A

Secondary prompt.

22
Q

Sequence \a expansion?

A

audible terminal bell.

23
Q

Sequence \d expansion?

A

date in “Weekday Month Date” format.

24
Q

Sequence \h expansion?

A

the hostname up to the first “.”

25
Sequence \T expansion?
the current time in 12-hour HH:MM:SS format
26
Sequence \u expansion?
the username of the current user.
27
Sequence \W expansion?
the basename of the current working directory.
28
Sequence \! expansion?
the history number of this command.
29
Sequence \$ expansion?
if the effective UID is 0, a #, otherwise a $.
30
Sequence \nnn expansion?
the character corresponding to the octal number nnn.
31
Shell Flags: The set Builtin Command: | Flag -f and its effect...?
Disable Pathname Expansion (Globbing)
32
Shell Flags: The set Builtin Command: | Flag -n and its effect...?
Read commands, but do not execute them (used for performing syntax checks on scripts).
33
Shell Flags: The set Builtin Command: | Flag -o optionname and its effect...?
Set the specified option. Some of the more common options include the following. emacs Use emacs style command line key bindings ignoreeof Do not exit shell when EOF (CTRL-D) is read vi Use vi style command line key bindings
34
Shell Flags: The set Builtin Command: | Flag -v and its effect...?
Print commands as they are read (useful in debugging scripts)
35
Shell Flags: The set Builtin Command: | Flag -x and its effect...?
Print commands after expansions have been applied (useful in debugging scripts and examining shell expansions)
36
Shell Flags: The set Builtin Command: | Flag -C and its effect...?
Don't allow the shell to clobber files on redirection.
37
Shell Flags: The set Builtin Command: | Examples...?
[madonna@station madonna]$ set -f [madonna@station madonna]$ ls /etc/*.conf ls: /etc/*.conf: No such file or directory [madonna@station madonna]$ set +f [madonna@station madonna]$ ls /etc/*.conf /etc/aep.conf /etc/lftp.conf /etc/pnm2ppa.conf
38
Shell Options: The shopt Builtin Command: | Option cdspell and its effect...?
Attempt to correct minor misspellings of directory names when using the cd builtin command.
39
Shell Options: The shopt Builtin Command: | Option expand_aliases and its effect...?
Enable shell aliases.
40
Shell Options: The shopt Builtin Command: | Option extglob and its effect...?
Enable extended globbing pattern matching syntax.
41
Shell Options: The shopt Builtin Command: | Option nocaseglob and its effect...?
Do not consider case when applying file globbing.
42
Shell Options: The shopt Builtin Command: | Examples...?
``` [madonna@station madonna]$ shopt cdspell cdspell off [madonna@station madonna]$ shopt -s cdspell [madonna@station madonna]$ cd /ect /etc [madonna@station etc]$ ls -d /ect ls: /ect: No such file or directory [madonna@station etc]$ shopt -u cdspell [madonna@station etc]$ cd /ect -bash: cd: /ect: No such file or directory ```
43
Shell scripts are sourced with the ...?
source or . commands.
44
Shell scripts are all executed in the same shell that...?
sources the script.
45
See slide 19 for ...?
bash initialization.