Class 26 Flashcards

1
Q

If the variable dir_name had the value “hw”, how would you use this variable to create the string “hw10”?

A

${dir_name}10

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

What is the value stored in the special parameter $ ?

A

The process ID of the current shell.

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

What is the value stored in the special parameter ! ?

A

The process ID of the last command sent into the background

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

What is the value stored in the special parameter ? ?

A

The exit status of the last command run.

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

What is the value stored in the positional parameter 0 ?

A

The pathname used to run a script

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

What are the values stored in the positional parameters 1 to n ?

A

The value of the corresponding command line argument

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

What is the value stored in the special parameters * and @ ?

A

all the command line arguments

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

How are the values of the special parameters set?

A

they are set by Bash

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

What happens after the following command is run in a script? shift

A

all positional parameter values are moved to the previous positional parameter

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

What happens after the following command is run in a script? shift 2

A

all positional parameters values are moved to the positional two steps lower

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