Term
first line of a shell script |
|
Definition
indicates what the shell script will use to run, usually it is: #!/bin/bash |
|
|
Term
you just created a text file script.sh, why won't it run |
|
Definition
|
|
Term
add execute rights to sysinfo.sh |
|
Definition
|
|
Term
/usr/local/bin isn't in your user path, add it |
|
Definition
export PATH=$PATH:/usr/local/bin |
|
|
Term
how can you make it so that /usr/local/bin is always in your path |
|
Definition
edit ~/.bash_profile to add /usr/local/bin |
|
|
Term
you want to debug a sysinfo.sh, run so you can see what is going on |
|
Definition
sh -x /usr/local/bin/sysinfo.sh |
|
|
Term
you added -x to the end of the first line of sysinfo.sh, what does that do |
|
Definition
1st line, #!/bin/bash -x debugs, prints the command, then the output |
|
|
Term
edit sysinfo.sh to make it always run in debug mode |
|
Definition
make the first line: #!/bin/bash -x -x for debug |
|
|
Term
you are using vi, add line numbers to the screen |
|
Definition
|
|
Term
add a local variable SYS_NAME as rhel5 |
|
Definition
|
|
Term
echo the variable SYS_NAME in a sentence |
|
Definition
|
|
Term
you set the variable SYS_NAME in a script, the script ended. What do you get when you enter: echo $sys_NAME |
|
Definition
nothing, the local variable was set in the script, it disappeared since it was in a sub-shell that is now closed |
|
|
Term
you have two local variables, SYSNAME and OSSYS, make them global |
|
Definition
|
|
Term
set the variable SYS_NAME as the hostname of the system |
|
Definition
SYS_NAME=`hostname` use backticks (forward quotes) |
|
|
Term
set OS_VER as the output from uname -r |
|
Definition
os_ver=`uname -r` -Confirm that this works, didn't work on Fedora 8 |
|
|
Term
how do you capture command output into a variable |
|
Definition
use backticks (forward quotes) ex: VAR1=`date` |
|
|
Term
how do you use script command line arguments |
|
Definition
$1 to $9 represent arguments 1-9 ${10} arguments 10+ |
|
|
Term
what is the total number of arguments |
|
Definition
|
|
Term
echo all the arguments passed to a script |
|
Definition
|
|
Term
echo the PID of the running script |
|
Definition
|
|
Term
echo the command or script from the script |
|
Definition
|
|
Term
echo the command(script), then echo arg1, then arg2 |
|
Definition
|
|
Term
|
Definition
|
|
Term
echo argument 1, toss out arg1 and make arg2 the new arg1 at the same time, echo the new arg1 |
|
Definition
|
|
Term
|
Definition
tosses out argument1 and moves everthing down one |
|
|
Term
how do you make a script interactive |
|
Definition
read VAR1 reads the input from the user, feeds it to a variable |
|
|
Term
what are some common escape sequences according to that stupid book |
|
Definition
\c - carriage return \a - bell \t - tab \n - new line |
|
|
Term
let the user enter a file name so you can use it for the FILE arg - echo FILE |
|
Definition
|
|