This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: sourcing a perl script on cygwin


Florin Barbalau wrote:

> then If i run:
> $ /cygdrive/d/cdb_10_2/content/bin/system/ifssetenv.pl
> it works ok.
> 
> but if I try to source as in the calling script (install_cdaa.sh) I
> get error messages. :
> $ . /cygdrive/d/cdb_10_2/content/bin/system/ifssetenv.pl
>  bash: use: command not found
> bash: use: command not found
> bash: /cygdrive/d/cdb_10_2/content/bin/system/ifssetenv.pl: line 31:
> syntax erro
> r near unexpected token `$^O'
> bash: /cygdrive/d/cdb_10_2/content/bin/system/ifssetenv.pl: line 31:
>  `if (lc($^O
> ) eq "mswin32")'
> 
> do you have any ideea why?

You have a misunderstanding of what sourcing means.  When you tell the
shell to source a file it expects to read shell commands from that
file.  It doesn't expect to find foreign commands in another language
like perl, and it doesn't honor the shebang since that is just a comment
in shell syntax.  When you run a script, as opposed to sourcing it, the
OS (in this case Cygwin) reads the shebang line (#!/bin/perl) to know
what program to use to interpret the script, which is why that works.

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]