Class 18 Flashcards

1
Q

What is special about a global variable?

A

you can use it in any subshell of the shell in which it was created.

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

What are the limitations of a local variable?

A

you can only use it in the shell in which it was created

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

What would you write on the command line to set the value of the local variable named team to Red Sox.

A

team=”Red Sox”

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

If you define a local variable, can a script see the value of this variable?

A

no

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

What would you write on the command line to create the global variable named school to UMass Boston.

A

export school=”UMass Boston”

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

Write the command you would use in a script to ask the user to provide a value for a variable named dir

A

read -p “Directory: “ dir

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

What command would you use to see all global variables?

A

env

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

What character would you use if you wanted to run two commands in the foreground, one right after the other, on a single command line?

A

;

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

What other two characters allow more than one command to be run on a single command line?

A

& and | (the pipe character)

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

How can you continue a command onto the next line?

A

type \ immediately before hitting Enter

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