LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-10-2009, 12:40 PM   #1
Nature Nut
LQ Newbie
 
Registered: Mar 2009
Posts: 5

Rep: Reputation: 0
Need to Convert .CMD files to run under linux


I am moving from OS/2 to linux and have a number of CMD files that I need to be able to run under linux. I thought that dosemu might be best, but maybe not. Here's the scenereo:

To get started, a CMD file runs a DOS program is run to display a menu and write a CMD file which contains commands to execute the menu selection selected, then the CMD file calls the file that was just written.

The new CMD file needs to call a text editor (some text files are larger than dosemu's edit can handle). When the text editor is exited, a DOS program is run against the text file to do stuff like building a HTML table from the data. Then it calls the original CMD file.

As best I can tell, dosemu does not understand that CMD files are executible, but no problem to change all to BAT, including calls within files.

In OS/2, I could call the native text editor (AE) for editing, but I don't seem to be able to call the linux native editor (gedit in my case).
Can gedit be called from a BAT file?

If I create linux scripts, how do I call dosemu with both the DOS filename and any parameters?

My goal is to try to have something that is Win compatible - with minor changes like path and editor. When the time comes for me to hand the system over to someone else, they'll most likely NOT be using linux.
 
Old 04-10-2009, 01:44 PM   #2
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by Nature Nut View Post
I am moving from OS/2 to linux and have a number of CMD files that I need to be able to run under linux. I thought that dosemu might be best, but maybe not. Here's the scenereo:

To get started, a CMD file runs a DOS program is run to display a menu and write a CMD file which contains commands to execute the menu selection selected, then the CMD file calls the file that was just written.

The new CMD file needs to call a text editor (some text files are larger than dosemu's edit can handle). When the text editor is exited, a DOS program is run against the text file to do stuff like building a HTML table from the data. Then it calls the original CMD file.

As best I can tell, dosemu does not understand that CMD files are executible, but no problem to change all to BAT, including calls within files.
There are many problems here, without even knowing what your script is about it's difficult to say anything concrete. About dosemu, note that's a DOS emulator, and it's not necesarilly compatible with an os/2 script. CMD and BAT scripts are compatible -and here's the key- for the most part, but not 100%.

I am no master in os/2 scripting. I did a bunch of bat scripting for DOS years ago. For a started, I think that they handle errorlevels differently, so that might (or might not) be an issue if you rely on them for the menu.

Quote:
In OS/2, I could call the native text editor (AE) for editing, but I don't seem to be able to call the linux native editor (gedit in my case).
Can gedit be called from a BAT file?
As far as I know, there're binary builds of ae(.exe) for dos. So I suggest you download one of them and use it inside the dosemu vm.

Quote:
If I create linux scripts, how do I call dosemu with both the DOS filename and any parameters?
If you took this approach, I'd better advice to port the script to linux. Whomever takes your place in the future can continue using the old .cmd script once you leave. Can't him?
 
Old 04-16-2009, 09:05 AM   #3
Nature Nut
LQ Newbie
 
Registered: Mar 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
There are many problems here, without even knowing what your script is about it's difficult to say anything concrete. About dosemu, note that's a DOS emulator, and it's not necesarilly compatible with an os/2 script. CMD and BAT scripts are compatible -and here's the key- for the most part, but not 100%.
The scripts, although nested, are not complicated. I've attempted to explain the function of each script/EXE below, without posting the scripts themselves. Nothing secret, just trying to save space. If you'd like to see the actual scripts, I'd prefer to do that via email instead of posting all that text here - contact me at webmaster at gnps dot org.

RunMenu runs a BASIC program called MENU, which presents a list of webpages to build. Once a selection is made, MENU writes DoWork, a script that calls a couple of scripts. Then DoWork is called to execute the commands written by MENU.

The first script BuildPagename, opens the page's datafile in the OS (OS/2 in the CMD file) text editor. Once editing is done, a BASIC program is called to read through the datafile and write HTML for the body portion of the webpage. Then it passes control back to DoWork.

DoWork passes control to a script that calls a BASIC program that adds the page body to a template (could be the one with the nav menu or without it, depends on page) and generates FTP commands to upload the page (but I'm not concerned about that at this point, looks like command line FTP works the same as OS/2). Once the program completes, the script moves the webpage to the mockup of the website on my hard drive, and uploads the page. Control is then passed back to RunMenu.

Quote:
I am no master in os/2 scripting. I did a bunch of bat scripting for DOS years ago. For a started, I think that they handle errorlevels differently, so that might (or might not) be an issue if you rely on them for the menu.
DOS scripting and what I've done are *very* much alike. There are 3 differences between standard DOS scripts and what I'm using under OS/2.

1) Calling OS/2's text edtor to edit datafiles (TXT)
2) Copy 8.3 name to long filename
3) Call OS/2 FTP with file of commands to upload files

For #1, any text editor that handles large text files will do, #3 might be a problem under dosemu, but I haven't gotten far enough along to start working on that. My holdup is #2 at the moment.

I ran into a problem when trying to move the webpage to the mockup location. Dosemu won't copy the long filenames used for the webpages, even though it seems to support them otherwise - all work files are 8.3 because of DOS limitations under OS/2, but the file is renamed when moved by OS/2 in the original CMD files.

Quote:
As far as I know, there're binary builds of ae(.exe) for dos. So I suggest you download one of them and use it inside the dosemu vm.
The DOS ae.exe I found was not a text editor, but I did find one that could handle files quite a bit larger than any I have. :-)

Quote:
If you took this approach, I'd better advice to port the script to linux. Whomever takes your place in the future can continue using the old .cmd script once you leave. Can't him?
Didn't think of that option. That is, indeed, a viable option. The scripts may change over time, mainly additions.

I've tried porting to linux but not much luck. I can get the MENU program to run, and the DoWork script is called, but the BuildPagename script is not found. Might that have to do with the first part of the script name being BUILD? I noticed, in the error message, that part of the filename, along with the first letter of the remainder of the name is missiing. For example, the name of one script is BuildCalendarPage.sh (originally BuildCalendarPage.CMD), the error message says it can't find alendarPage.sh.

Could it be the CR/LF at the end of the lines in DoWork? I can change that easily enough, but don't want to worry with it if it isn't necessary.
 
Old 04-20-2009, 05:03 AM   #4
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
DOS scripting and what I've done are *very* much alike. There are 3 differences between standard DOS scripts and what I'm using under OS/2.

1) Calling OS/2's text edtor to edit datafiles (TXT)
2) Copy 8.3 name to long filename
3) Call OS/2 FTP with file of commands to upload files

For #1, any text editor that handles large text files will do, #3 might be a problem under dosemu, but I haven't gotten far enough along to start working on that. My holdup is #2 at the moment.
I really don't know how dosemu works about that regard, and I don't own a copy of os/2 either to compare. Can't help much with that. But you might want to try dosbox or freedos inside an VM like virtualbox. Maybe that will work better, I don't really know.

Quote:
The DOS ae.exe I found was not a text editor, but I did find one that could handle files quite a bit larger than any I have. :-)
I only know about this one: http://www.nyangau.fsnet.co.uk/

I am not sure that it's the one you use, but it seems to have a DOS version.

Quote:
Could it be the CR/LF at the end of the lines in DoWork? I can change that easily enough, but don't want to worry with it if it isn't necessary.
That can be easily converted using dos2unix. However it would surprise me that that's a problem for dosemu. After all, is a DOS emulator and its purpose is compatibility with DOS.
 
  


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
Cmd line to convert .doc and .xls to .txt ? frenchn00b Linux - General 2 04-15-2013 12:05 PM
Is it possible to convert 'run' files to slackware packages? j0rd4n Slackware 6 01-15-2007 06:50 PM
cmd line prog to convert mp3 samplerate kmasaryk Linux - Desktop 4 11-25-2006 12:05 AM
linux 102. run cmd @ bootup bonito SUSE / openSUSE 7 03-30-2005 09:43 AM
Convert video mode from 32 to 24 using text login in CMD (no gui) ? HELP !!! jalalmn Linux - General 6 03-19-2005 05:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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