Flashcards in Topic 7 - Unix Shell Environments Deck (44):
the full path name of your home directory
the name of your login shell
the full path of the current working directory
the user name of the logged in user
the kind of terminal the user is using
which X server to display on
the directories the shell should search to find a command
the name of e the computer you are using
the name of the host logged-in from
the directories the man command should search to find man pages
Shell variable names can be made up of:
Shell variable names cannot begin with:
Shell variables can store either:
string of characters, or NULL
Shell variables can be accessed by putting a ____ in front of ____
putting a $ in front of their names. e.g., echo $HOME
Are variable names case-sensitive?
What are the two kinds of shell variables?
Environmental variables (GLOBAL) & Regular Variables (LOCAL)
Define environmental variables
Affecting the current shell and the programs invoked from the shell.
Define regular variables
Affecting the current shell, but not the programs invoked from the shell
Which type of shells define their shell variables in each of the following:
- .cshrc and .login
.profile = Bourne-Style shells
.cshrc and .login = C-Style shells
C-Style Shells: How do you set a variable?
C-Style Shells: Clearing a regular (local) variable?
C-Style Shells: How do you set environment variables?
setenv EnvironemntVarialbe EnvironemntValue **No "=" sign here!**
C-Style Shells: How do you clear environment variables?
C-Style Shells: How do you list all environment shell variables?
Regular shell variables?
1) "printing" or "env"
2) "set" without any arguments
Bourne-Style Shells: How do you set a regular (local) variable?
varname=varvalue (there is no "set" here - also, no spaces before / after "=" !!!)
Bourne-Style Shells: How do you clear regular (local) variable?
unset varname (same as C-Style Shell)
Bourne-Style Shells: How do you set an environmental variable?
Same as local variable (EnvironmentVariable = EnviromentValue)
Then, use "export EnvironmentVariable"
Bourne-Style Shells: How do you clear an environmental variable?
unset EnvironmentVaraible (only 'unset' - same as regular variables)
Bourne-Style Shells: How do list all local variables? Environmental variables?
"set" - lists ALL existing local AND enviro variables
"print env or just env" will list ONLY enviro (exported) shell variables
Once a variable is exported, the only way to stop the export effect is to _____
"unset" the variable
The shell searches in each directory of $Path how?
In left to right order and executers the first version.
What does "which" cmd do?
locates a unix command and displays its pathname or alias
What does .login do?
Runs once when you log in: contains one-time things like terminal setup
What does .cshrc do?
Runs before the execution of any [t]csh process: Sets lots of variables, e.g., PATH, MANPATH etc.
In C-Style shells, what does "history" cmd do?
Displays the command history list with line numbers
List the ways to rerun a command line in the history:
1) !! - reruns last command
2) !str - returns the latest command beginning with str
3) !n - where n is a number; reruns command number n in the history list
The variable savehist determines:
How much history to be saved in the file name histfile for your next session;
Where are savehist and hostile variables likely to be set?
In C-Style shells: in your .cshrc file. Example:
What is the "alias" cmd syntax?
alias alias-name real-command
Can you put your aliases in your .cshrc file?
Can you display the alias of a command using the which command?
What does the alias command without any arguments do?
Lists ALL existing aliases.
How do you delete alias(s)?
Using the "unalias" cmd: unalias alias-anem