dexter_mich...@emc.com wrote: > Hello, > > I installed Cygwin yesterday and when I run it and look at "pwd" my path > is set to: /cygdrive/h > > I read the FAQ and when I type "set HOME" from a Windows CLI, it is set > to: > HOME=H:\ > > I am using Cygwin for PERL. > > I just took a PERL course and in class Cygwin was configured for: > /usr/bin/perl > > This was perfect because I could make my SheBang look like: > #!/usr/bin/perl
Looking through the rest of your message, it appears that you don't have a clear understanding of the SheBang line and its use. Either that, or I'm just missing something. Sorry if you already understand what follows. The SheBang line tells Cygwin where the interpreter for the script you're running is located. In your case, you want the program at /usr/bin/perl to run the script when under Cygwin. This is because the Perl program is installed to /usr/bin/perl. Under a Unix system, the SheBang line has the same function, but as you have apparently discovered, the Perl program is often installed elsewhere on those systems. This would require a different SheBang line of course unless you're a little clever. See below... > I would like to do that again with the Cygwin I installed myself > yesterday. Unless you did something very strange in your Cygwin installation, it should already be set up so that using a SheBang line as you did in your class will work without modification. If the scripts you made in class under Cygwin are not working for you in your personal Cygwin installation, please send along the specific errors you see when you try to run those scripts. > I did modify /etc/passwd. > The last line had: ...:/cygdrive/h:/bin/bash > and I changed it to: ...:/usr/bin/perl:/bin/bash I don't think this change will solve the problem you're having. Assuming you modified the line corresponding to your account, you are telling Cygwin that you want your home directory to be /usr/bin/perl. However, /usr/bin/perl is not a directory but rather a program file. > But when I open a new Cygwin session it remembers the old /cygdrive/h Since you have a Windows environment variable set to H:\, it takes precedence over any setting you place into /etc/passwd. If you do indeed want whatever you place into /etc/passwd to take effect, you need to remove that environment variable definition before starting your shell session. Andy Koppe already covered those details. > Could someone help me? I don't want to have to change my SheBang > everytime I deploy a PERL script to Unix after having created it in > Cygwin on Windows. There are a number of solutions for writing Perl scripts which can automatically handle differing locations for the Perl installations on various systems. What I do for the scripts I maintain is set the SheBang line as follows: #!/usr/bin/env perl Then the only requirement for users is that the Perl program (perl) be available in the PATH environment variable when they run the script. When they run the script, the env program finds perl in PATH and runs it to execute the script. Since the env program is generally available as /usr/bin/env and most users have PATH set to include perl, this method has been highly successful. -Jeremy
signature.asc
Description: OpenPGP digital signature