ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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
Well, I'd probably drop support for Windows, which would greatly simplify things.
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.
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?
Yes. All drives available in Windows (C:\, D:\, E:\ etc.) are "mounted" under /cygdrive with their respective drive letter as the folder. Cygwin has a clever parser for Windows paths, thus, to access C:\Program Files using Cygwin, you can either do:
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).
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.)
Install MKS on the Windows systems? Mortice Kern Systems? *n*x utilities running under native Windows?
Sorry for part-information; I was in a hurry and wanted to at least leave some pointers that might be useful. MKS may help; it is commercial and has shifted its focus from "UNIX utilites on Windows" to "Developlment life cycle toolkits". Nonetheless, from the MKS site, "MKS Toolkit for Developers ships with many commands and utilities — awk, sed, Perl, CShell, KornShell, Graphical KornShell, and more". According to this press release, bash is included in version 8.6.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.