Question: Hi Im having a really hard time trying to figure out Operating Systems Linux task. much help would be greatly appreciated Write a bash shellscript
Hi Im having a really hard time trying to figure out Operating Systems Linux task. much help would be greatly appreciated
Write a bash shellscript that acts as a dos command interpreter where the user enters the dos command and the script executes the corresponding Linux command.
The script has to loop continuously until the user enters the QUIT command
Prior to accepting a command display a prompt containing your first name and the greater than symbol (>)
Example prompt: linux>
The DOS command and any arguments should be stored in variables
$command the DOS command (required)
$arg1 the first argument (optional)
$arg2 the second argument (optional) Note: Only some DOS/Linux commands will require one or both argument variables.
The script should use case statements to select the appropriate Linux command
If an unknown DOS command is entered, display the error message, Command Not Found!
Refer to table below for a list of DOS commands and their Linux counterparts (COMMAND [ARG 1] [ARG 2])
| DOS Command * | Linux Command |
| CHDIR [target directory] | cd [target directory] |
| CLS | clear |
| COPY [source file] [destination file] | cp [source file] [destination file] |
| CREATEDIR [directory name] | mkdir [directory name] |
| CREATEFILE [file name] | touch [file name] |
| DELETE [file name] | rm [file name] |
| DIR [file name | directory name | wildcard] | ls [file name | directory name | wildcard] |
| MOVE [source] [destination] | mv [source] [destination] |
| PRINT [message to print] | echo [message to print] |
| QUIT | N/A |
| RENAME [old name] [new name] | mv [old name] [new name] |
| TYPE [file name] | cat [file name] |
| * Assume DOS commands are case-insensitive (i.e., DIR is the same as dir). | |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
