This is the mail archive of the
mailing list for the Cygwin project.
Re: alias appears to not work inside a called bash script
- From: Kaz Kylheku <920-082-4242 at kylheku dot com>
- To: cygwin at cygwin dot com
- Date: Tue, 22 Aug 2017 12:47:52 -0700
- Subject: Re: alias appears to not work inside a called bash script
- Authentication-results: sourceware.org; auth=none
On 21.08.2017 15:53, Eliot Moss wrote:
From the bash man page:
"Aliases are ot expanded when the shell is not interactive, unless
the expand_aliases shell option
is set using shopt (see the description of shopt under SHELL BUILTIN
Could that be the root of your difficulty?
There is an issue there (though not for the Cygwin project).
I don't see where this behavior is required in POSIX: that is,
expanding aliases in interactive mode, but ignoring them in
POSIX seems to unequivocally be calling for Alias Expansion to occur
under all conditions.
And, indeed, this is not a bug in Bash; they know that this is
a POSIX deviation. Because, voila, aliases *are* expanded in
script mode if we do one of two things:
Bash in POSIX mode knows every well that it had better
expand aliases regardless of non-interactive operation.
However, *suppressing* a useful behavior in a default, non-standard
mode is highly counter-intuitive.
I mean we can't even call this a vendor *extension* with a straight
face. What do we call this? "retraction?" :)
"To disable the vendor-specific retraction that aliases don't
work, operate bash in POSIX mode, or use the expand_aliases
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple