A File Begins With Bin Csh This Means
Question: The echo command is:
Answer: used to output text to the console
Question: A file begins with #!/bin/csh. This means:
Answer: Running the script will invoke /bin/csh to interpret the rest of the file.
Question: Which are appropriate editors for writing shell scripts?
Answer: vi and nano
Question: Most of nano’s commands take the form of:
Answer: Control and another character
Question: What does this shell script do? FOO=/tmp/foo if [! -d $FOO ]; then mkdir $FOO fi
Answer: Creates /tmp/foo if it does not exist
Question: Which of the following are correct about for and while loops?
Answer: for loops operate over a fixed list of items and while loops have a test each cycle to determine if it should run again.
Question: Given the following part of a script: if [ -f $1 ]; then echo “I am here” fi
Answer: It is a special variable that indicates the exit code of the command before it.
Question: Given the following script that is run through .test.sh hello goodbye if [ -f $2 ]; then echo “I am here” fi
Answer: If a file called “goodbye” exists in the current directory.
Question: What is the correct way to assign the word “Hello” to a variable?
Answer: A=”Hello”
Question: What is the correct way to save the current directory to a variable?
Answer: A=’pwd’