LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-27-2010, 02:31 AM   #1
apanimesh061
Member
 
Registered: Sep 2010
Posts: 51

Rep: Reputation: 0
Exclamation Problem in running DOS emulator ...!!!!!


Code:
function forcd 
{ 
  len=`wc -c ~/Pictures/file2 | cut -c1-2` 
  echo $len 
  cutcmd=`cut -c4-$len ~/Pictures/file2` 
  echo $cutcmd 
  cd $cutcmd 
} 

newvar=`pwd` 
clear 

echo "root"$newvar">" 
read cmd 

until [ "$cmd" == "exit" ]; 
do 
   echo $cmd > ~/Pictures/file1
   cutcmd2=`cut -c1-2 ~/Pictures/file1` 
   echo $cutcmd2 

if [ "$cmd" == "dir" ]; then 
   ls -l 

elif [ "$cmd" == "dir /p" ]; then 
     ls -l | more 

elif [ "$cmd" == "cd .." ]; then 
     cd ../ 

elif [ "$cutcmd2" == "cd" ]; then 
     echo $? 
     echo $cmd > ~/Pictures/file2 
     forcd 

elif [ "$cmd" == "cls" ]; then 
     clear 

else echo "ERROR-----> Invalid filename or  command......!!!!!!" 

fi 

newvar=`pwd` 
echo "root"$newvar">" 
read cmd 

done
I tried to make a DOS emulator.
I am having problem in executing the 'cd <directory_name>' command.
There is some problem in 'cutcmd2'. It is supposed to be 'cd' but it always empty.
I made two files in ~/Documents ---> file1, file2.
But when I execute this script...another file with the name 'file1?' is created which I guess is the problem...!!!
Please help...!!!!!ASAP
 
Old 12-20-2010, 03:27 AM   #2
rigor
Member
 
Registered: Sep 2003
Location: 19th moon ................. ................Planet Covid ................Another Galaxy;............. ................Not Yours
Posts: 705

Rep: Reputation: Disabled
It actually seems to work for me, under bash. Are you using bash, or some other shell?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
dos emulator problem tsallinia Linux - Software 4 12-09-2006 05:47 AM
DOS Emulator in Linux gammatech Linux - Software 2 03-14-2006 03:46 AM
Dos Emulator without Dos dtheorem Linux - Software 1 10-14-2003 01:18 PM
Dos Emulator without Dos dtheorem Linux - Software 1 10-14-2003 12:52 PM
DOS emulator titanium_geek Programming 3 10-18-2002 02:29 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration