Q2 50-74 Flashcards
Assuming that you are running a Bourne-shell and the abc file does not exist, what is the output of the following Unix commands: cd /tmp; pwd > abc; ln abc ABC; rm abc; cat ABC
- Bring us to /tmp folder
- Write a new file abc with our pwd, /tmp
- Link abc to ABC
- Removes the original abc file
- Cannot open ABC, because the file it’s hard linked to has been removed
Predict the output of the following commands: cd ~ pwd tcsh cd / pwd exit pwd
- Change Directories to the user’s home directory
- Show our Present Working Directory
- Change our shell to C shell (tcsh)
- Change Directories to absolute root
- Show our Present Working Directory
- Exit C shell
- We will now be back at our user’s home directory (cd ~) because changing shells doesn’t affect our pwd.
In tcsh shell, how do you create a regular variable?
set varname = variable
In sh shell, how do you create a regular variable?
varname = variable
In tcsh shell, how do you change a value of a regular variable?
set varname = newVariable
In sh shell, how do you change a value of a regular variable?
varname=newVariable
In tcsh shell, how do you delete a regular variable?
unset varname
In sh shell, how do you delete a regular variable?
unset varname
In tcsh shell, how do you create an environment variable?
setenv environmentVarname environmentVariable
NO EQUAL SIGN
In sh shell, how do you create an environment variable?
environmentVarname=EnvironmentVariable
export EnvironmentVarname
In tcsh shell, how do you change a value of an environment variable?
setenv environmentVarname newEnvironmentVariable
In sh shell, how do you change a value of an environment variable?
unset environmentVarname
environmentVarname=newEnvironmentVariable
export EnvironmentVarname
In tcsh shell, how do you delete an environment variable?
unsetenv environmentVarname
In sh shell, how do you delete an environment variable?
unset environmentVarname
What is the difference between regular shell variables and environment shell variables?
Global/Environmental affects the current shell and all the programs invoked from that shell.
Local/Regular affects only the current shell but none of the shell it invokes.