Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is what I have right now, but I need help correcting some errors. #!/bin/bash for P in `echo $* | sed -e 's/^:/.:/' -e

image text in transcribed

This is what I have right now, but I need help correcting some errors.

#!/bin/bash

for P in `echo $* | sed -e 's/^:/.:/' -e 's/::/:.:/' -e 's/:$/:./' -e

's/:/ /g'`

do

case $NP in

"")

NP="$P"

;;

$P|$P:*|*:$P:*|*:$P)

continue

;;

*)

NP="$NP:$P"

;;esac

done

echo $NP

ERRORS: Missing 2 cases, a : and a :

Help with running program in terminal

Write a shell script to concatenate lists together, and output the resulting list. Do not include any argument that is a sub-list of the entire list. (The script will clean the list of any redundant items.) You must preserve the original order of the list. Remember to account for the following situations: - a : at the beginning of the list is the same as a . at the beginning of the "list" - a :: anywhere in the list is the same as :.: - a : at the end of the list is the same a :. /bin: is the same as /bin:. Project using temporary files will not be graded. The input to the script will be colon or space separated lists and the output will be a colon separated list with the original order preserved and all redundant items removed. USAGE: clean_list list .... Where list a a colon or whitespace separated list. Examples: prompt> clean_list a a:b a:b:c :x: y:z a:b:c::x:y:z prompt>clean_1ist/bin:/usr/bin:/usr/openwin/bin /usr/bin:/usr/etc:/etc: /usr/bin/x11 .:/bin /bin:/usr/bin:/usr/openwin/bin:/usr/etc:/etc: .:/usr/bin/X11 prompt>clean_list apple:orange:apple pear orange peach apple: orange:pear:peach REMEMBER TO HANDLE THE SPECIAL CASES OF LEADING:, A ::, AND A TRAILING

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 1 Lncs 13426

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124227, 978-3031124228

More Books

Students also viewed these Databases questions

Question

using signal flow graph

Answered: 1 week ago

Question

18. If you have power, then people will dislike and fear you.

Answered: 1 week ago