Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Message-Id: <199904210926.CAA05012@shell4.ba.best.com> Subject: Re: running Cygwin shell scripts from a bat file In-Reply-To: from Nancy McGough at "Apr 20, 99 07:22:40 pm" To: nm AT NoAdsPlease DOT ii DOT com (Nancy McGough) Date: Wed, 21 Apr 1999 05:26:09 -0400 (EDT) Cc: cygwin AT sourceware DOT cygnus DOT com From: Glenn Spell Reply-To: glenn AT gs DOT fay DOT nc DOT us (Glenn Spell) Organization: the aerie X-Mailer: ELM [version 2.4ME+ PL38 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit I'll be rambling on in this message... something about teaching a man to fish... Nancy McGough wrote: > I think that the main problem is that Cygwin and its docs are > designed for programmers I think that's a fair characterization. I also think that Cygnus has developed this list in such a way to subtly discourage discussions of user issues and that's understandable. However, such discussions are not unwelcome. Another related perception that I have about the whole deal is that Cygnus would like for Cygwin to be the "Linux of the Windows world" while employing the "Cathedral Model"... may it never be. I believe this creates a aura of schizophrenia that tends to infect this list. (Hmm... maybe I should enter "schizoid" in the Cygnus name contest.) > and all I want to do is run my Unix scripts on files that are on my > Win98 machine. I think that's a reasonable expectation. [skipping a paragraph] > Again, I would really like a pointer to some docs that explain how > to use all the great things about Cygwin and the great things about > Win98 Sorry, there are none. Here's the deal... you find pointers to using Unix and then you find pointers to using Win95/98 (those are the easy parts) and _then_ you interpolate between the two. Cool, huh? :-) (Schiziod! Were's that name contest webpage?) [back to the skipped paragraph] > And I'd love to be able to do that from within Windows Explorer > rather than having to open up the Cygwin bash window and doing > everything the Unix command-line way. Ahhh, but you *do* open up the Cygwin bash window from within Windows Explorer (or the desktop, same-o same-o). You probably use the DOS batch file that the Cygnus installation program installs. The main purpose of this batch file is to set up an environment for Cygwin, primarily concerning paths. The batch file is not necessary. You can double-click on any Cygwin app from within Explorer and the app will run (if it can find the Cygwin DLL, again--an environment/path issue). The Cygwin environment is a Windows/DOS environment. (Most of the intricate stuff is built into the Cygwin DLL.) Cygwin appears to be Unix but it is not Unix... it emulates Unix. One way to combine your present Windows environment and the needed Cygwin environment is to take the stuff from the Cygnus start batch file and add it to your autoexec.bat and move the Cygwin DLL to C:\Windows\System... but I wouldn't recommend it. Instead, I'd recommend you copy the Cygnus start batch file to something like say perl.bat and replace the bash command line with a perl command line: C:\Cygnus\cygwin-b20\usr\local\bin\perl.exe /posix/path/to/script The first part has to be in Windows format because it's a DOS batch file. The path to the script can be in either Windows or POSIX format because perl will be reading it and perl uses the Cygwin DLL that knows how to deal with either path syntax. With this method, you establish the environment for each invocation, while maintaining your standard Windows environment for all other Windows stuff. Also, you can make a Windows shortcut to this batch file and place the shortcut anywhere you like, for example C:\Windows\Sendto. Now you have two command lines. The one in the PIF (shortcut), to the batch file (accessed by right-click/properties) and the one at the end of the batch file to perl. Where "%1"s will need to be placed can be determined by experimentation. If you mix and match Cygwin and Explorer as you suggest, you may want to put the Cygwin DLL in C:\Windows\System but you need to make sure that there is only *one* such DLL around. Actually, using a batch file as I suggest, this move may be unneccessary. It all depends on how you set up the environments and $PATH (excuse me, %PATH%... this is not Unix, or is it? :-). Another thing that may confuse the issue is that *after* you start bash with the Cygnus batch file, you can change the bash environment further with .bashrc, etc. But, that's a different issue. I hope I've painted some pictures that will help. At any rate, I'll stop now and wait for responses or corrections from others. [Columbo ON] Just one more thing. [Columbo OFF] In an earlier message, you asked about what path to put at the top of perl scripts. I'd recommend "#! /usr/local/bin/perl". Someone recommended getting perl to /usr/local/bin with a symbolic link. That'll work. But, your perl is probably already at /usr/local/bin/perl as a result of the default "mounting". Mounting "C:\Cygnus\cygwin-b20" to "/" will put it there. For reference information on the 'mount' command see: To check the current posix path to perl from the bash prompt: bash$ cygpath -u `cygcheck perl | head -2 | tail -1` bash$ type perl | cut -d " " -f 3 However, none of that is related. The purpose of the top line in the script is to tell the Unix shell what program to pass the script to. You'll be using the Explorer shell. The batch file will call perl *and* the script (top line not needed) and clicking on "sendto" will tell Explorer to pass the selected file to the batch file. (So "%1" will be needed at the end of the perl command line at the end of the batch file as someone else has already pointed out, won't it?) -glenn -- ) Glenn Spell ) _ _____ ) Fayetteville, North Carolina, U. S. A. )_ (__\____o /_/_ | ) _ _ _ _ _ _ _ _ _ _ _ _ _ _ ) >----- _/_/__]> )- blue skies - happy trails - sweet dreams -) `0 | -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com