Create a DOS-like shell on top of the bash shell (so that when you enter "del" it executes the "rm" command in Linux)
I've got all that working fine, my issue, is that when you type in a command that is just a regular Linux command, it should pass it to the bash shell for execution.
This is what I have so far, and again, this works fine for the 'dos-like' commands:
#!/bin/bash #operating in the bash shell
stop = 0 #stop has a value of 0
while [ stop -eq 0 ] #loop when stop is equal to 0
do #start loop
echo - n $HOME\> #prompt is set to home variable
read reply1 reply2 reply3 #read variables for first, second, and third reply.
case $reply1 in
"cd") #when user types "cd", execute change directory command.
rm $reply2 #when user types "del", execute remove command for specified parameter.
mv $reply2 $reply3 #when user types "ren", execute the move (rename) command.
ls | more #when user types "more", execute the display one screen command (ls | more).
cp $reply2 $reply3 #when user types "copy", execute the cp comand for <file> <file>
cp -R $reply2 $reply3 #when user types "xcopy", execute the cp command with recursive parameter.
I'm thinking the best option would be to use an "if" statement, and have anything executable passed to the shell, but I'm not sure how to properly type it and debug it.
if [ $reply1 -x ]
$reply1 | /bin/bash
---------not sure what do to for the else portion?
If anybody could give me any suggestions on a way to have this work, it would be greatly appreciated!
Basically I don't see the point in what the OP is trying to achieve. If you are more comfortable with Windows commands than Unix ones then just use Wndows. If you can't be bothered to learn the Unix commands why bother with the OS?
And if you really do want to write your own shell, for whatever reason, use C not shell scripts.