Class 18 Flashcards
What is special about a global variable?
you can use it in any subshell of the shell in which it was created.
What are the limitations of a local variable?
you can only use it in the shell in which it was created
What would you write on the command line to set the value of the local variable named team to Red Sox.
team=”Red Sox”
If you define a local variable, can a script see the value of this variable?
no
What would you write on the command line to create the global variable named school to UMass Boston.
export school=”UMass Boston”
Write the command you would use in a script to ask the user to provide a value for a variable named dir
read -p “Directory: “ dir
What command would you use to see all global variables?
env
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?
;
What other two characters allow more than one command to be run on a single command line?
& and | (the pipe character)
How can you continue a command onto the next line?
type \ immediately before hitting Enter