Explore BrainMass
Share

A demonstration of various unix shell commands

This content was STOLEN from BrainMass.com - View the original, and get the already-completed solution here!

Copy the following shell that completes the following:

#!/bin/bash
echo Select a country from the following list:
echo America, Italy, France, Germany
read country

case $country in
[Aa]merica ) echo Ford; echo Perhaps;;
[Ii]taly ) echo Ferarri;echo no;;
[Ff]rance ) echo Peugeot ;echo no way;;
[Gg]ermany ) echo Porsche ;echo yes;;

esac

Run the shell from above.

Answer the following questions:
- What is the purpose of the echo command?
- In the case statement, why are the first letters both caps and lower case?
- What does esac mean?

Create your own shell that completes the following problem:
- Ask the user their name.
- Compare it to your name.
- Give a reply that their response is either your name too or it is a nice name too.

© BrainMass Inc. brainmass.com October 24, 2018, 10:36 pm ad1c9bdddf
https://brainmass.com/computer-science/pattern-matching/a-demonstration-of-various-unix-shell-commands-164456

Solution Preview

The echo command is used to print something to the screen. In this case it is printing a prompt that is asking the user to enter their country.

The first letters of each case in the case statement are enclosed in square brackets ([]) this means that either letter is accepted as a match. Since both an upper and lower case letter are in each ...

Solution Summary

In this solution I provide an explanation of the commands found in a simple shell script. I also write a new shell script that prompts the user for their name and prints a message.

$2.19
See Also This Related BrainMass Solution

Usefulness of given UNIX commands to forensic investigators

1. Explain in layman terms the following UNIX commands. For each command, point out its usefulness to forensic investigators.

finger
showmount
mount
echo
rlogin
whoami
rsh
rpcinfo
ypwhich
tcpmap
telnet

2. What does the term "pipe" mean in UNIX? Give 3 examples to illustrate your answer.

View Full Posting Details