Cross platform BASH scripts?
I currently have apps that are compiled for execution on Windows and Linux and distributed.
I have a bash script that collects and tars the files needed for a linux distribution. I have similar batch files on winows. Rather than maintain and enhance, as needed, a bash script and a batch file for every product, I would like to have a single script for each app, maybe even a single script for all apps, on both linux and windows. I had originally thought about using python, or perl, to do this, but I already have pretty decent bash files and batch files done. I know I can run bash scripts under Cygwin on a windows machine, but will that allow me to access all the files on the Windows machine, outside of the cygwin home? Any suggestions on how YOU would handle this? CD |
Quote:
As far as I can remember, Cygwin will only be able to see what's in the Cygwin home, but I could be mistaken. Don't have alot of experience with it, but I do seem to remember that. Perl is a great solution, but you may have problems with Windows, though, since not all Windows boxes have a decent (or any) Perl installation. If you had a Samba mount from your Linux box to your Windows box (smbclient), you could use your Linux script to create a Windows 'set', or use Windows to mount the Linux box, and do it the other way around. Without knowing more about your environment, and what you're trying to do, it's hard to say more. |
Install MKS on the Windows systems? Mortice Kern Systems? *n*x utilities running under native Windows?
|
Quote:
Code:
cd "C:\Program Files" Code:
cd /cygdrive/c/Program\ Files |
Thanks for all the answers. Is sounds like Cygwin may be my best choice. How about MinGW/MSYS? I had forgotten about MinGW/MSys until after I posted my question(s).
CD |
MinGW / MSYS works fine also
|
There are also strand-alone nix-like utilities for use under win32, but no full bash shell. I have seen a version of zsh for windows. Would save having to have msys or cigwin installed, but you'd probably have to change some of your script syntax to use zsh instead of bash.
|
I had used zsh from the unixutils in sourceforge in all
versions of windows up to XP with no problems. However in vista it didn't work so well (crashes occasionaly). msys on the other hand (with bash as its default shell) worked perfectly in vista As far as I'm concerned msys is much better than cygwin. If you use standard sh syntax you can use exactly the same script with bash or zsh (zsh has features found in korn and bash shell but it uses a different syntax on some of these: arrays, setting the prompts PS1, etc.) |
Quote:
|
All times are GMT -5. The time now is 01:26 PM. |