Question

You must write the shell in C/C++ for Linux systems, and the shell must have the...

You must write the shell in C/C++ for Linux systems, and the shell must have the following
functionality :
can use command list to list files and directory of a given directory;

Homework Answers

Answer #1

echo " "

echo "----Implementing Directory Management----"

echo " "

ch=0

while [ $ch -lt 6 ]

do

echo "Press the following to :"

echo "1) Create a new directory."

echo "2) Modify a directory."

echo "3) Navigate into directory."

echo "4) Listing directories."

echo "5) Exit."

read ch

  

case $ch in

1) echo " "

echo "---Creation of Directory---"

echo " "

echo "Enter the name of the directory:"

read name

mkdir $name

;;

2) echo " "

echo "---Modification of Directory---"

echo " "

echo "Enter the directory to be modified:"

read orgdir

echo "Press the following to :"

echo " "

echo "1) Rename directory."

echo "2) Copy directory to another."

echo "3) Move directory."

echo "4) Delete directory."

echo "5) Exit from Modify Mode."

read modch

  

case $modch in

1) echo " "

echo "---Rename a directory---"

echo " "

echo "Enter new name for the directory:"

read newname

mv $orgdir $newname

;;

2) echo " "

echo "---Copying a directory to another---"

echo " "

echo "Enter target directory:"

read target

mkdir $target

cp $orgdir $target

;;

3) echo " "

echo "---Moving a directory---"

echo " "

echo "Enter target directory:"

read target

mkdir $target

mv $orgdir $target

;;

4) echo " "

echo "---Deleting a directory---"

echo " "

rmdir $orgdir

;;

5) echo " "

echo "---Exiting from modify mode---"

echo " "

exit

;;

esac

;;

3)  

echo "---Navigation of Directory---"

echo " "

echo "Enter your choice for method of navigation :"

echo "1) Go to Parent Directory. "

echo "2) Navigate to specific directory."

echo "3) Exit from Navigate Mode."

read navch

  

case $navch in

1) echo " "

echo "---Parent Directory---"

echo " "

cd ..

pwd

;;

2) echo " "

echo "---Navigation to Specific Directory---"

echo " "

echo "Enter the target Path:"

read path

cd $path

pwd

;;

3) echo " "

echo "---Exiting from Navigate Mode---"

echo " "

exit

;;

esac

;;

4)  

echo "--- Listing of Directories---"

echo " "

echo "Enter your choice for method of listing :"

echo "1) List of directories. "

echo "2) List of directories and their details."

echo "3) Exit from List Mode."

read lisch

  

case $lisch in

1) echo " "

echo "---List of directories---"

echo " "

ls

;;

2) echo " "

echo "---Detailed List of directories---"

echo " "

ls -l

;;

3) echo " "

echo "---Exiting from List Mode---"

echo " "

exit

;;

esac

;;

5)echo " "

echo "---Exiting---"

echo " "

exit

;;

esac

done

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Linux File Systems: Please write down a pseudo code that implements shell command “find . -name...
Linux File Systems: Please write down a pseudo code that implements shell command “find . -name myfile -print”.
Linux File Systems: please write down a pseudo code that implements shell command “find . -name...
Linux File Systems: please write down a pseudo code that implements shell command “find . -name myfile -print”.
PLEASE DO QUICK LINUX ASSIGNMENT PLEASE ILL THUMBS UP You need to paste the command and...
PLEASE DO QUICK LINUX ASSIGNMENT PLEASE ILL THUMBS UP You need to paste the command and the output in a word document and submit it. Part1: 1. Log in to Linux using your user account name and password. 2. If you logged in using a graphical login screen, open a terminal window by clicking on the icon in the lower left corner of the desktop to open the main menu, then selecting System Tools, then Terminal. A terminal window opens....
Write a shell program named HELOO (this should be done linux) Your program should set permissions...
Write a shell program named HELOO (this should be done linux) Your program should set permissions for a file named A1testFile so that the current premissions remain, except execute permissions are REMOVED for everyone, including owner. Your must accomplish this with a single chmod command. A1testFile should be specified as a relative path name to a file in the current directory (the directory the user is in when they run your program). Your program should not display any error messages,...
should be in Linux, please Write a shell program named A1L21 Your program should set permissions...
should be in Linux, please Write a shell program named A1L21 Your program should set permissions for a file whose name is given as an argument to your program. The permissions must be changed using a SINGLE chmod command, and must be set to EXACTLY rw for owner and group and x for others. Your program should NOT show any error messages on the screen, even if the given file does not exist, etc.
Using a Linux terminal, write a script, called UnixHistory.sh, which will generate an abbreviated "tree" of...
Using a Linux terminal, write a script, called UnixHistory.sh, which will generate an abbreviated "tree" of the Unix and Unix like operating system ancestry. The data source, as always, can be found on Wikipedia: https://en.wikipedia.org/wiki/File:Unix_history.svg The Unix history begins with a directory named ResearchUnix that has two children: BSD and Commercial. BSD has two children FreeBSD and NextStep, NextStep has a single child directory: MacOSX. Commercial has one sub-directory named Solaris NOTE all the elements mentioned above are directories, created...
Which of the following refers to a specific implementation of a Linux operating system? Kernel Shell...
Which of the following refers to a specific implementation of a Linux operating system? Kernel Shell Module Distribution Which type of Linux distribution, which includes Red Hat Enterprise Linux, is designed to be used in a business setting? Home or amateur Live distro Commercial Security enhanced A Linux distribution is also called a Linux __________. shell module distro CLI A system with at least __________ of RAM should be able to support at least one VM. 6GB 8GB 4GB 2GB...
List a sequence of Linux commands you would execute after you successfully log on to your...
List a sequence of Linux commands you would execute after you successfully log on to your VM machine, make a directory called midterm in your home directory, create a simple C program called display.c in the newly created directory, compile the code using gcc compiler, and run the program, and finally, save the output to a text file called display.txt. Remember to briefly explain each command.
What command would you use to view the files and folders in the C:\windows directory? Use...
What command would you use to view the files and folders in the C:\windows directory? Use relative references. What command would you use to view only the directories in the C:\windows directory? Use relative references. Hint: Use a switch. What command would you use to view only the .com files in the C:\windows\system32 directory? Use relative references. What command would you use to create a directory called JUNK at the root. Use relative references. What command would you use to...
Write Linux command lines to do the following: 1. Create a directory with name “yourName_ID” 2....
Write Linux command lines to do the following: 1. Create a directory with name “yourName_ID” 2. Create a file with name “yourLastName.txt” inside the directory created in step.1 3. Write inside the created file exactly the following content (you may use editors such as vim, pico, ….): Linux Lab Lab. ToDo#1 Summer Semester 2019/2020# 4. Display the first 2 lines of the file. 5. Change the permission of the file to read write and execute for owner, groups and others....
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT