LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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, 03: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, 04: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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 06:47 AM
DOS Emulator in Linux gammatech Linux - Software 2 03-14-2006 04:46 AM
Dos Emulator without Dos dtheorem Linux - Software 1 10-14-2003 02:18 PM
Dos Emulator without Dos dtheorem Linux - Software 1 10-14-2003 01:52 PM
DOS emulator titanium_geek Programming 3 10-18-2002 03:29 PM

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

All times are GMT -5. The time now is 04:07 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