Usetutoringspotscode to get 8% OFF on your first order!

  • time icon24/7 online - support@tutoringspots.com
  • phone icon1-316-444-1378 or 44-141-628-6690
  • login iconLogin

linux operation system management

linux operation system management

1. Create a file named breeds and type in the following information:

echo “Enter the name of a breed of animal”

read breed

case $breed in

arabiam|palomino|clydesdale) echo “$breed is a horse”;;

jersey|guernsey|holstein) echo “$breed is a cow”;;

husky|shepherd|setter|labrador) echo “$breed is a dog”;;

siamese|Persian|angora) echo “$breed is a cat”;;

*) echo “$breed is not in our catalog”;;

esac

2. Save and exit the editor

3. Make the file breeds executable

4. Run the program 5 times, and give the output for each:

First try type: husky

Second try type: holstein

Third try type: clydesdale

Fourth try type: angora

Fifth try type: terrier

5. Type the following program into your editor, and then run it.

#!/bin/sh

clear

echo “Use one of the following options:”

echo “d To display the time and date”

echo “p To see what directory you are currently in”

echo “w To see a list of who is online”

echo “Enter your option and hit Enter: c”

read option

case $option in

a. date;;

p) pwd;;

w) who;;

*) echo “That was not a valid selection”;;

esac

echo “Good bye”

6. Explain what the program above accomplished:

7.

clear

echo “Type a letter from the Greek alphabet”

read letter

case $letter in

Alpha|alpha|ALPHA) echo “$letter is the first letter in the Greek alphabet”;;

Beta|beta|BETA) echo “$letter is the second letter in the Greek alphabet”;;

Gamma|GAMMA|gamma) echo “$letter is the third letter in the Greek alphabet”;;

OMEGA|omega|Omega) echo “$letter is the last letter in the Greek alphabet”;;

*) echo “$letter is not a letter in the Greek alphabet”;;

esac

Explain what the pipe symbol is doing in the above program.

8. Write your own case statement where the user can type the name of a Car Maker, and your program will give a response determined by you. For example:

Question: What Car Maker are you interested in?

User Response: Ford

Program Response: Ford is a good car

Do this for 4 different car makers. Also remember to include a catchall in case the user types in a car maker that does not exist.

9. Using your knowledge of the while loop, take the program from #5, and nest that case statement inside a while loop, so the case statement will keep on running until q is typed. I left spaces below where the parts of the while loop, and the interactivity between the user and the program would go (ex. asking the user to enter a new choice, and allowing for it).

Line 1: # Use a counter

line 2: clear

line 3: “Use one of the following options:”

line 4: echo “d To display the time and date”

line 5: echo “p To see what directory you are currently in”

line 6: echo “w To see a list of who is online”

line 6: echo “ Enter your option and hit Enter: c”

line 7: read option

line 8:

line 9:

line 10: case $option in

line 11: d) echo `date`;;

line 12: p) echo `pwd`;;

line 13: w) echo `who`;;

line 14: *) echo “That was not a valid selection”;;

line 15: esac

line 16:

line 17:

line 19:

line 20: echo “Good Bye”

10. Using the car maker script from number 8, add a while or an until to make it run over and over until the user types Q.

Responses are currently closed, but you can trackback from your own site.

Comments are closed.

linux operation system management

linux operation system management

1. Create a file named breeds and type in the following information:

echo “Enter the name of a breed of animal”

read breed

case $breed in

arabiam|palomino|clydesdale) echo “$breed is a horse”;;

jersey|guernsey|holstein) echo “$breed is a cow”;;

husky|shepherd|setter|labrador) echo “$breed is a dog”;;

siamese|Persian|angora) echo “$breed is a cat”;;

*) echo “$breed is not in our catalog”;;

esac

2. Save and exit the editor

3. Make the file breeds executable

4. Run the program 5 times, and give the output for each:

First try type: husky

Second try type: holstein

Third try type: clydesdale

Fourth try type: angora

Fifth try type: terrier

5. Type the following program into your editor, and then run it.

#!/bin/sh

clear

echo “Use one of the following options:”

echo “d To display the time and date”

echo “p To see what directory you are currently in”

echo “w To see a list of who is online”

echo “Enter your option and hit Enter: c”

read option

case $option in

a. date;;

p) pwd;;

w) who;;

*) echo “That was not a valid selection”;;

esac

echo “Good bye”

6. Explain what the program above accomplished:

7.

clear

echo “Type a letter from the Greek alphabet”

read letter

case $letter in

Alpha|alpha|ALPHA) echo “$letter is the first letter in the Greek alphabet”;;

Beta|beta|BETA) echo “$letter is the second letter in the Greek alphabet”;;

Gamma|GAMMA|gamma) echo “$letter is the third letter in the Greek alphabet”;;

OMEGA|omega|Omega) echo “$letter is the last letter in the Greek alphabet”;;

*) echo “$letter is not a letter in the Greek alphabet”;;

esac

Explain what the pipe symbol is doing in the above program.

8. Write your own case statement where the user can type the name of a Car Maker, and your program will give a response determined by you. For example:

Question: What Car Maker are you interested in?

User Response: Ford

Program Response: Ford is a good car

Do this for 4 different car makers. Also remember to include a catchall in case the user types in a car maker that does not exist.

9. Using your knowledge of the while loop, take the program from #5, and nest that case statement inside a while loop, so the case statement will keep on running until q is typed. I left spaces below where the parts of the while loop, and the interactivity between the user and the program would go (ex. asking the user to enter a new choice, and allowing for it).

Line 1: # Use a counter

line 2: clear

line 3: “Use one of the following options:”

line 4: echo “d To display the time and date”

line 5: echo “p To see what directory you are currently in”

line 6: echo “w To see a list of who is online”

line 6: echo “ Enter your option and hit Enter: c”

line 7: read option

line 8:

line 9:

line 10: case $option in

line 11: d) echo `date`;;

line 12: p) echo `pwd`;;

line 13: w) echo `who`;;

line 14: *) echo “That was not a valid selection”;;

line 15: esac

line 16:

line 17:

line 19:

line 20: echo “Good Bye”

10. Using the car maker script from number 8, add a while or an until to make it run over and over until the user types Q.

Responses are currently closed, but you can trackback from your own site.

Comments are closed.

Powered by WordPress | Designed by: Premium WordPress Themes | Thanks to Themes Gallery, Bromoney and Wordpress Themes