Necro1992
Necro1992

Reputation: 139

UNIX script to run on WINDOWS

I got a couple of questions,

Is there any way to make a UNIX script run under a windows OS without any add-on like CYGWIN?

Is there any way to transform a UNIX script to a windows batch script, so that i can run it in windows cmd ?

I searched for that but i get referred to the UNIX command win2unix or unix2win , the ones that transform a file from/to windows/UNIX format.

Thanks for the help.

Upvotes: 4

Views: 940

Answers (2)

ingyhere
ingyhere

Reputation: 13831

Another answer for this old question is to install and run light Unix-like emulators. Here are some options:

  • MinGW -- native Windows port of the GNU Compiler Collection (GCC)
  • MSYS -- command line terminal called mintty, bash, version control systems like git and subversion, tools like tar and awk and even build systems like autotools
  • GitBash -- BASH emulation used to run Git from the command line. *NIX users should feel right at home

The above list installs micro environments much lighter than a typical Cygwin install. Also, in my experience most Bash scripts run on par with native Linux environments in these environments.

Yet another option is installing a Linux Subsytem like WSL2.

Yet another option is converting Bash to DOS by hand or with partial assistance of something like Bash-to-BAT converter, which isn't very full featured, and the Advanced Bash-Scripting Guide.

Upvotes: 1

Olivier Dulac
Olivier Dulac

Reputation: 3791

I know you don't want an "add on", but if this may help : you can download MobaXterm (or a portable version of it), which will come with many things, including many unix utilities (shell, etc) and lots you can download from their website.

The portable version is the most convenient (and you can carry it on your usb key, for example)

It's quite slower than cygwin/etc (most commands are emulated via some master binary, and many shell "builtins" becomes instead invocations of that binary, for example), but very portable and neat.

Other solutions (converting, etc) probably will also entail a binary of some sort, so I recommand the above, as it's very portable and gives you a kind of "mini unix inside windows"

Upvotes: 2

Related Questions