Converting unix shell scripts to dos batch files

Converting unix shell scripts to dos batch files

Post by Nikolaos Giannopoulo » Fri, 11 Jul 2003 09:00:08



Anyone know of a tool or site that converts unix (bourne) shell scripts
to dos batch files (for NT/2000/XP)?

Thanks,

--Nikolaos

 
 
 

Converting unix shell scripts to dos batch files

Post by p.. » Fri, 11 Jul 2003 10:14:08



> Anyone know of a tool or site that converts unix (bourne) shell scripts
> to dos batch files (for NT/2000/XP)?

www.freebsd.org or www.redhat.org

Both the above ( and others) will convert a nt2000 machione to one
capable of interpretinmg bourne shell scripts.

Antother possibility is cygnus.

Otherwize the wintendo/dos shells are hoplessly incapable, there is no way
of "emulating" the functionality of bourne-scripts on doscmd.

Quote:> Thanks,
> --Nikolaos

--
Peter H?kanson        
        IPSec  Sverige      ( At Gothenburg Riverside )
           Sorry about my e-mail address, but i'm trying to keep spam out,
           remove "icke-reklam" if you feel for mailing me. Thanx.

 
 
 

Converting unix shell scripts to dos batch files

Post by Michael Heimin » Fri, 11 Jul 2003 21:24:01




>> Anyone know of a tool or site that converts unix (bourne) shell scripts
>> to dos batch files (for NT/2000/XP)?
> www.freebsd.org or www.redhat.org
> Both the above ( and others) will convert a nt2000 machione to one
> capable of interpretinmg bourne shell scripts.

He, I was going to say that...
;)

Quote:> Antother possibility is cygnus.

AFAIR "cygwin", but I wouldn't waste my time with it, option 1 is for sure
the easier way.

--
Michael Heiming

Remove +SIGNS and www. if you expect an answer, sorry for
inconvenience, but I get tons of SPAM

 
 
 

Converting unix shell scripts to dos batch files

Post by Chuck Dillo » Fri, 11 Jul 2003 23:15:48



> Anyone know of a tool or site that converts unix (bourne) shell scripts
> to dos batch files (for NT/2000/XP)?

> Thanks,

> --Nikolaos

Do you really want DOS or do you want something that will run in the
native NT/2K/XP shell?  They are not the same thing.  I'll assume the
latter.  If such a thing exists it would be from a Winders centric
source.  So you might try asking in ms-windows centric forums about
such a tool.  Which you may have already done.

The best solution I know of is to install a pseudo-UNIX environment on
the Winders box.  One that may be able to interpret the script as is.
The script may well need to be tweaked but not completely re-written.

Two free options are U/Win from
http://www.research.att.com/sw/tools/uwin/.  It comes with ksh, sh and
tcsh.  I use it for scripting on my Win2k box at work.  The other is
cygwin from cygwin.com.  It has a similar capability.

These packages come with core UNIX commandline programs ported to
Winders.  So if you script uses 'cp' they provide a 'cp' that will do
what the script expects.  No need to map cp calls to copy calls.

There are also commercial solutions from folks like mks.com and
microsoft.com.

-- ced

--
Chuck Dillon
Senior Software Engineer
NimbleGen Systems Inc.

 
 
 

Converting unix shell scripts to dos batch files

Post by Nikolaos Giannopoulo » Sun, 13 Jul 2003 01:36:27


  > Do you really want DOS or do you want something that will run in the

Quote:> native NT/2K/XP shell?  They are not the same thing.  I'll assume the

What I want is a tool that would take a first cut at reading in a shell
script and producing a dos batch file equivalent - I don't mind cleaning
it up thereafter.

We have a Java app that makes calls to shell scripts for
pre/post-installation of our product on Solaris and Linux.

We need to have DOS batch file equivalents for our NT/2000/XP installs.

Unfortunately we don't control the target box so we can't use
interpreters (nor would we want to as they are only required for
installation).

Quote:> latter.  If such a thing exists it would be from a Winders centric
> source.  So you might try asking in ms-windows centric forums about such
> a tool.  Which you may have already done.

I have asked in c.o.msdos.programmer and I'm hearing its impossible
though our shell scripts do not use really advanced commands.

I have also come accross this:
http://www.tldp.org/LDP/abs/html/dosbatch.html

And for a Dos to Unix script check out:
http://garbo.uwasa.fi/pc/batchutil.html
Specifically: batcsh10.zip  28440 Jan 12 1994
Convert MS-DOS batches to Unix csh scripts, fw, B.Pierpoint

Which gives some hope so I guess I'll keep looking.  Thanks.

--Nikolaos

 
 
 

Converting unix shell scripts to dos batch files

Post by Nikolaos Giannopoulo » Sun, 13 Jul 2003 01:37:47



> www.freebsd.org or www.redhat.org

> Both the above ( and others) will convert a nt2000 machione to one
> capable of interpretinmg bourne shell scripts.

Interpreters won't unfortunately work as I replied in another post on
this thread ;-)  Thanks for the idea though.

Quote:

> Antother possibility is cygnus.

> Otherwize the wintendo/dos shells are hoplessly incapable, there is no way
> of "emulating" the functionality of bourne-scripts on doscmd.

It depends what one requires I guess - I'm not looking for the full
breadth of shell commands.

Thanks,

--Nikolaos

 
 
 

Converting unix shell scripts to dos batch files

Post by Tim Slatter » Sun, 13 Jul 2003 01:43:17



>What I want is a tool that would take a first cut at reading in a shell
>script and producing a dos batch file equivalent - I don't mind cleaning
>it up thereafter.

IMHO the WinNT/WinXP batch language is so far inferior to *any* *NIX
shell scripting language that there's just no way to do it. Again
IHMO, you'd be far better off trying to run the *NIX shell scripts
using Cygwin or U/Win as Chuck Dillon suggested.

--
Tim Slattery

 
 
 

Converting unix shell scripts to dos batch files

Post by Chris F.A. Johnso » Sun, 13 Jul 2003 02:38:25



> Anyone know of a tool or site that converts unix (bourne) shell scripts
> to dos batch files (for NT/2000/XP)?

   That's like asking for something to convert CDs to play on your
   1950's HiFi.

   Short of installing a UNIX shell on the Windows box, the best
   alternative is to convert the script to C (I remember seeing tools
   to do that) and compiling it for Windows.

--
    Chris F.A. Johnson                        http://cfaj.freeshell.org
    ===================================================================
    My code (if any) in this post is copyright 2003, Chris F.A. Johnson
    and may be copied under the terms of the GNU General Public License

 
 
 

1. Convert small shell script to batch file

Hallo,

I have a small shell script which I want to run in a DOS environment.
IMO the easiest way will be to rewrite it as a batch file.

However my knowledge of msdos syntax is rather poor, I really did not
succeed doing it myself.

Can anyone please help me to make a batch file out of this shell script?

TIA

#!/bin/sh
#

# remove .tex extension (if any)
name=`echo $1 | sed 's/\(.*\)\.tex$/\1/'`

# if file exists
if [ -f "$name.tex" ]; then
  /cygdrive/c/<path1>/latex2html.bat "$name.tex"
  # if last command was successful
  if [ $? = '0' ]; then
    "/cygdrive/c/<path2>/Psp.exe" "$name/img1.gif"
  fi
fi

2. Linux routing problem?

3. DOS Batch file into a shell script

4. 1.2 Gig drive big enough for Linux?

5. Looking for shell script to DOS batch file converter

6. Source of latest versions

7. Unix Script to convert text files to DOS format?

8. Linux and IBM Turbo 16/4 TokenRing

9. Convert Bash shell script to Korn shell script

10. Convert a unix file to a dos file with SED

11. Convert a group of Dos files to Unix files

12. syntax cmd awk to convert unix file to dos file

13. Converting Java batch file from windows to unix format