Name:
class section:
- (2 points) Create a shell script called lstmp which contains the command to do a long listing of /tmp. Show the contents of your script here:
- What command did you use to add execute permission to lstmp?
- (3 points) Create a shell script called corefind which runs a find command across the entire filesystem to locate files named core. Show the contents of the shell script here:
- (3 points) Create a shell script to display names and UIDs from the /etc/passwd file. Hint: The cut or awk command will prove very useful here. Show the contents of the shell script here:
- Show the syntax of the command to check your PATH:
- What is the first directory in your PATH?
- What does the first line (#!/bin/bash ) do in a shell script?
- What are two ways to give all users execute permission on a file?
- (4 points) Write a shell script to grab all lines which contain the string ssh from /var/log/messages, sort them alphabetically, and then put them into a file called /ssh.mesg. Show the contents of the script here:
- (4 points) Write a shell script which completes the following sentence, filling the first blank with the first argument, and the second blank with the second argument to the shell script:
I like __________ Jell-O with chopped bits of ________ best
. Show contents of the script here:
- 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:
- Show the syntax of the command to set the shell variable MAX_STUDENTS equal to 24:
- (2 points) Write a shell script that will check the shell variable MAX_STUDENTS, and print out the message 'sorry, that is too many' if it is 25 or more:
- (EXTRA CREDIT, 6 points) Create a shell script which will print the phrase 'I like Linux' in the middle of the screen, pause 5 seconds, clear the screen, and print 'I cannot wait to work with it full time'. It should then keep that message on the screen for 5 more seconds, clear the screen and exit. You may find the sleep, tput and clear commands to be useful. Show your shell script here: