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”.
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.
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....
Linux Operation SECTION 2 – File and Directory Permissions: FILE PERMISSIONS: What is the command used...
Linux Operation SECTION 2 – File and Directory Permissions: FILE PERMISSIONS: What is the command used to find out which user account you are logged into?      . This command may come in handy in the following exercises. Ensure you are in your home directory of the student1 account. Use the echo command with output redirection to create a file called labfile4 and put the following text in this file: “This is the first line of labfile4”. Using the symbolic notation...
Write UNIX commands to perform the following tasks. Each task must use exactly one line of...
Write UNIX commands to perform the following tasks. Each task must use exactly one line of command. Unless stated otherwise, all files are assumed to be at your current working directory. a) (10 points) Print your current working directory into a file named file1 b) (10 points) Assume that your current working directory is NOT the same as your home directory. Print all file and subdirectory names of your home directory into a file named file2. c) (15 points) Copy...
5. Write a bash command that will display the name of every file on the Linux...
5. Write a bash command that will display the name of every file on the Linux system whose file contaent contains the string "doug.jones". The command must run in the background, must redirect standard error to /dev/null, and must redirect standard output to ~/out. 6. Write a bash command that will kill all of the even-numbered processes associated with your userid, and no other processes. 7. Write a bash command that will start the program /home/courses/140u-doug.jones/zombie_maker as a background process,...