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
Q

Sequence \T expansion?

A

the current time in 12-hour HH:MM:SS format

26
Q

Sequence \u expansion?

A

the username of the current user.

27
Q

Sequence \W expansion?

A

the basename of the current working directory.

28
Q

Sequence ! expansion?

A

the history number of this command.

29
Q

Sequence $ expansion?

A

if the effective UID is 0, a #, otherwise a $.

30
Q

Sequence \nnn expansion?

A

the character corresponding to the octal number nnn.

31
Q

Shell Flags: The set Builtin Command:

Flag -f and its effect…?

A

Disable Pathname Expansion (Globbing)

32
Q

Shell Flags: The set Builtin Command:

Flag -n and its effect…?

A

Read commands, but do not execute them (used for performing syntax checks on scripts).

33
Q

Shell Flags: The set Builtin Command:

Flag -o optionname and its effect…?

A

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
Q

Shell Flags: The set Builtin Command:

Flag -v and its effect…?

A

Print commands as they are read (useful in debugging scripts)

35
Q

Shell Flags: The set Builtin Command:

Flag -x and its effect…?

A

Print commands after expansions have been applied (useful in debugging scripts and examining shell expansions)

36
Q

Shell Flags: The set Builtin Command:

Flag -C and its effect…?

A

Don’t allow the shell to clobber files on redirection.

37
Q

Shell Flags: The set Builtin Command:

Examples…?

A

[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
Q

Shell Options: The shopt Builtin Command:

Option cdspell and its effect…?

A

Attempt to correct minor misspellings of directory names when using the cd builtin command.

39
Q

Shell Options: The shopt Builtin Command:

Option expand_aliases and its effect…?

A

Enable shell aliases.

40
Q

Shell Options: The shopt Builtin Command:

Option extglob and its effect…?

A

Enable extended globbing pattern matching syntax.

41
Q

Shell Options: The shopt Builtin Command:

Option nocaseglob and its effect…?

A

Do not consider case when applying file globbing.

42
Q

Shell Options: The shopt Builtin Command:

Examples…?

A
[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
Q

Shell scripts are sourced with the …?

A

source or . commands.

44
Q

Shell scripts are all executed in the same shell that…?

A

sources the script.

45
Q

See slide 19 for …?

A

bash initialization.