Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what script (like .bat) would run on windows, mac, and linux

I have a bat script that I'd like to make work on windows/Mac/linux, but I read .bat is only for windows. How can I make this script work on Mac and linux, or what type of script can I write that would work on all 3.

like image 727
sameold Avatar asked Nov 16 '11 18:11

sameold


2 Answers

No such beast. Windows doesn't support the unix-style shell scripts that Mac/Linux use, and Mac/Linux don't have command.com/cmd.exe needed to support .bat files.

There's ways to fake this, like running Wine on mac/linux and cygwin on Windows, but then that's a whole other ball of wax.

like image 198
Marc B Avatar answered Nov 15 '22 02:11

Marc B


If you don't want to step up to a language like C, I would suggest Python as a multi-platform scripting language. It's easy to learn and has lots of generic, multi-platform libraries and functions.

You'll need to install it on Windows, and maybe OS X as well. But it's not difficult in any way.

like image 26
Kris Harper Avatar answered Nov 15 '22 04:11

Kris Harper