Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am working on finishing some Intro. Unix/Linux shell scripting and am confused

ID: 3556945 • Letter: I

Question

I am working on finishing some Intro. Unix/Linux shell scripting and am confused because i have no experience, could you complete this program. Please help thank you very much!!

Create pathworks, a facility for viewing, editing and composing the PATH vriable in the BASH environment. The pathworks program should be menu driven and permit viewing the current environment PATH variable and changing it.

Ex:

MAIN MENU

Tues Jan 5 19:45:23 EDT 2013

1>show current PATH

2>create bash_path and bash_list

3>edit bash_list

4>remove bash_list

5>create bash_PATH from bash_list

6>test new path

7>show files

q>quit

Your choice? -- q

That's all, folks!

capture the PATH to a file called bash_path in the current directory. Deconstruct it into a list of directories in the current directory, Deconstruct it into a list of directories in bash_list. Provide an editing capability for the bash_list file. Reconstruct the bash_path file from bash_list after editing. Insert the new path in a .bash_PATH script for sourcing from your home directory.

Explanation / Answer

#! /bin/bash

echo "MAIN MENU"
date

echo "1>show current PATH"
echo "2>create bash_path and bash_list"
echo "3>edit bash_list"
echo "4>remove bash_list"
echo "5>create bash_PATH from bash_list"
echo "6>test new path"
echo "7>show files"
echo "q>quit"

echo "Your choice?"
read ans

looping=3

until [ $looping -lt 2 ]; do
case $ans in
1)
echo "Here is the path"
echo $PATH
echo "Your choice?"
read ans
;;
2)
echo "Create bash_path and bash_list"
echo $PATH > bash_path
if [ -f bash_list ]
then
rm bash_list
fi
for x in `echo $PATH | tr ":" " "`; do echo $x >> bash_list; done
echo "Your choice?"
read ans
;;
3)
echo "edit bash_list using vi"
vi bash_list
echo "Your choice?"
read ans
;;
4)
echo "Remove bash_list"
if [ -f bash_list ]
then
rm bash_list
fi
echo "Your choice?"
read ans
;;
5)
echo "Create bash_PATH from bash_list"
cat bash_list > bash_path
echo "Your choice?"
read ans
;;
6)
echo "test new Path"
echo $PATH
echo "Your choice?"
read ans
;;
7)
echo "how bash files"
ls bash*
echo "Your choice?"
read ans
;;
q)
echo "That's all, folks!"
let looping=1
;;
esac
done

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote