Chapter 9 - Writing Scripts, Configuring Email, & Using Databases Flashcards
what do environmental variables provide?
9-454
the means to pass named data to programs launched from a shell or a subshell
what is a subshell?
9-454
a child process that is created by either the shell or a shell script when a program is initiated
you’ve set an environment variable manually via an equal-sign assignment operator. what command must you use to make that variable to subshells?
9-455
the export command
how can you find out how environment variables are configured? (what do you type?)
9-455
env, set, or printenv
if you want to know the value of one variable, you can use the echo command, but how do you use it?
9-458
echo $variable
tell me 3 times when you would use an alias
9-459
- to assign names that are easier to remember in order to obscure commands
- to implement desirable command options as a command’s default
- to create a shortened version of a command to minimize typing
you are configuring shells via shell configuration files. tell me the 2 ways they are classified (4 combinations).
9-460
whether they are global or user files and whether they have login or non-login file locations
how can you see your current key bindings?
9-462
bind -p
true/false: most minux systems use bash by default
9-462
true
you are looking at a shell script. what tells the linux kernel that it is a shell script?
9-463
it begins with a #!
tell me 6 commands that are commonly used in scripts
9-464,465
file manipulation commands (ls, mv, cp, rm) grep find cut sed echo
is it possible to set a script’s SUID (SGID bits)?
9-465
yes
when you type the script’s name, preceded by bash, what does that do?
9-466
it tells linux to run the script in the current directory rather than searching the current path
what is a script?
9-462
a simple program written in an interpreted computer language that’s embedded in the linux shell, used for repetitive tasks
typing the script’s name, preceded by ./, tells linux what?
9-466
tells linux to run the script in the current directory rather than searching the current path
when would you type the script’s full path and name?
9-467
when the script is not located in your current working directory
typing in the script’s names requires the shell script to be moved to what?
9-467
moved to a directory on your path
typing the script’s name, preceded by sh, does what?
9-468
tells linux to run the script in the current directory rather than searching the current path
what happens when you type the source keyword before the script name?
is a subshell created to run the script?
9-468
it tells the bash shell to use a method type called sourcing.
no
typing a dot and a space before the script name does what?
9-469
tells the bash shell to use the sourcing method type
what does exec ./ script-name do?
does it need execute permission set on the file?
9-469
method for executing a file
yes
when you are using variables in shell scripts, what is a variable?
9-470
a placeholder in a script for a value that will be determined when the script runs
variables that are passed to the script are frequently called what?
9-471
positional parameters
tell me two places where a user defined variable can be used.
9-474
within a script
at the command line
when do you use / not use the dollar sign with a variable (environment or user defined)?
9-474
use the dollar sign if you’re doing anything WITH the variable, don’t use it if you’re doing anything TO the variable