OS515-Workbook6-part2 Flashcards Preview

Networking > OS515-Workbook6-part2 > Flashcards

Flashcards in OS515-Workbook6-part2 Deck (45):
1

The bash shell expands certain command line metacharacters before...?

interpreting the command.

2

Tilde expansion expands tokens that begin with a...?

tilde (~) to users home directories.

3

Brace expansion expands tokens with ...?

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...

4

Command substitution expands text enclosed within...?

backticks ('') or "dollar parenthesis" ($()) into the output produced by the enclosed command.

VAR=`COMMAND`

FILES=`ls /etc`
FILES=$(ls /etc)

5

Pathname Expansion ("File Globbing")
Covered earlier and is also...?

a shell expansion.

6

Remember that expansion occurs before the program is...?

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

7

Pathname Expansion:
Character * match?

0 or more characters

8

Pathname Expansion:
Character ? match?

Exactly one characters.

9

Pathname Expansion:
Character [...] match?

Exactly one of the included characters.

10

Pathname Expansion:
Character [^...]

Exactly one of the excluded characters.

11

See slide 8 for...?

command line expansion subtleties.

12

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

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

13

Shell aliases create apparent commands which...?

expand to arbitrary text.

14

The bash shell prompt can be...?

customized using the PSI variable.

15

Shell flags modify the ...?

bash shell behavior.

16

Shell options offer more...?

bash shell configuration options.

17

Slide 11 shows...?

Slide Builtins.

18

Slide 12 shows...?

Aliases

19

Running commands.

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

PS1...?

Default prompt.

21

PS2...?

Secondary prompt.

22

Sequence \a expansion?

audible terminal bell.

23

Sequence \d expansion?

date in "Weekday Month Date" format.

24

Sequence \h expansion?

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.