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: alias appears to not work inside a called bash script


On 8/22/2017 3:07 PM, cyg Simple wrote:
> On 8/22/2017 1:13 PM, Eliot Moss wrote:
>> On 8/22/2017 1:07 PM, cyg Simple wrote:
>>> On 8/22/2017 11:18 AM, Stephen John Smoogen wrote:
>>>> On 22 August 2017 at 10:47, Eliot Moss <moss@cs.umass.edu> wrote:
>>>>> On 8/22/2017 10:31 AM, Stephen John Smoogen wrote:
>>
>>> Are you talking bash as sh or bash as bash?  Bash as sh will expand
>>> those aliases.  But you should study
>>> http://tldp.org/LDP/abs/html/aliases.html for all your scripts.  Are
>>> there environment variables that could affect the outcome?
>>
>> Since the OP has a #! /bin/bash line at the top of his script, I think
>> he means bash.  However, running the script with sh explicitly does act
>> as you describe, e.g.:  sh myscript x y z ... in contrast to: myscript x
>> y z.
>>
> 
> There's also --posix and set -o posix which will cause bash to perform
> as the OP reports.  I'm guessing this to be used in the bash startup
> files in a global fashion on those systems that you're not having to
> specify to use aliases.
> 
> https://www.gnu.org/software/bash/manual/html_node/Bash-POSIX-Mode.html#Bash-POSIX-Mode
> 

And --enable-strict-posix-default configure option turns this setting on
by default.  I'll leave it up to the Cygwin maintainer to decide if it
should be used.

-- 
cyg Simple

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


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