Question
Write a bash script that will take a list of names as arguments and print out each name's group number. The group number for each
Write a bash script that will take a list of names as arguments and print out
each name's group number. The group number for each set of names is as
follows:
names that begin
with....
The group number is
...
A through H
10
I through M
20
N through Q
30
R through Z
40
Assume the user will correctly type in a name that starts with a capital or lower-
case letter.
HINTS
Below is an example output from my computer of running my version of the
script. To process each name, use a
case
statement inside a
for...in
loop. You
will need to pick up the first letter of the pattern. Use
[a-h]*
for the first group
and so on.... Note that ranges for letters is case insensitive so this should pick up
both capital and lower-case letters.
==========================
EXAMPLE OUTPUT
==========================
~$
chmod u+x lab8.sh
~$
./lab8.sh
need to enter a name
~$
./lab8.sh Henry ralph Alice
Henry, You are in group 10
ralph, You are in group 40
Alice, You are in group 10
~$
./lab8.sh Mimi
Mimi, You are in group 50
~$
./lab8.sh Sally Quincy thorsten Henry Jake
Sally, You are in group 40
Quincy, You are in group 30
thorsten, You are in group 40
Henry, You are in group 10
Jake, You are in group 20
===========================================================
To get credit for the lab, upload your script to the d2l assignment folder for lab
8 by Friday evening.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started