- Show the syntax of the command to check your PATH:
- What command will mark a variable named FOO as available to subshells?
- What is the syntax of the command to set the variable NEWPATH equal to the current value of PATH?
- Add the directory /usr/local/sbin to your PATH. Show the syntax of the command you used:
- Show the syntax of the command to set the shell variable MAX_STUDENTS equal to 24:
- Show the syntax of the command to make the shell variable BAR unavailable to subshells:
- Show the syntax of the command to set the variable TODAY equal to the results of the date command:
- Using the let command, set the variable SUM_1 equal to the sum of 14, 25 and 321. Show the command(s) you entered, and the result:
- (2 pts) Write a shell script which shows only the username and $HOME directory for each user listed in /etc/passwd. Have an appropriate header line displayed.
- Using the let command, set the variable quot equal to 122 divided by 7. Show command and result:
- (2 pts) Write an if-then statement which will result in the message "I like vi" being produced if the shell variable EDITOR is equal to "vi". Show the syntax of all the commands you used:
- (2 pts) Expand the above command so that it will produce the message "I do not know which editor I prefer" if the variable EDITOR is anything but "vi". Show the full statement:
- (2 pts) Create a for loop to read through the file http://www.linux-classes.com/downloads/shared/listitems and echo out the contents of each line:
- (2 pts) Enhance the above statement so that all items are added together, and a running total is displayed:
- (2 pts) Modify the above statement so that the total is only displayed at the very end, not as each number is added in:
EXTRA CREDIT
- (3 pts) Write a shell script which uses a while loop to take input from the keyboard and repeat it back to the user. Your shell script should ask the following questions: What is your favorite color? What is your quest? What is the flight speed of an unladen swallow? Do you wish to answer again? If the answer to the final question is anything but 'y', the loop should exit. Show your script here:
- (2 pts) Modify the above script so that it only asks the first three questions, and continues asking them until the final question is answered with "african or european?" Show your new script here: