public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Kaz Kylheku <920-082-4242@kylheku.com>
To: cygwin@cygwin.com
Subject: Re: alias appears to not work inside a called bash script
Date: Tue, 22 Aug 2017 19:47:00 -0000	[thread overview]
Message-ID: <40f2498d2efcf0f5214b476c80f9cb92@mail.kylheku.com> (raw)

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
> COMMANDS below)."
> 
> 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 
non-interactive
operation.

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:

    #!/bin/bash --posix

    #!/bin/sh

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
shopt."

:)


--
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

             reply	other threads:[~2017-08-22 19:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-22 19:47 Kaz Kylheku [this message]
2017-08-25  2:23 ` L A Walsh
  -- strict thread matches above, loose matches on Subject: below --
2017-08-21 22:30 Michel LaBarre
2017-08-21 22:53 ` Eliot Moss
2017-08-22 14:31 ` Stephen John Smoogen
2017-08-22 14:47   ` Eliot Moss
2017-08-22 15:19     ` Stephen John Smoogen
2017-08-22 16:46       ` Eliot Moss
2017-08-22 18:25         ` Stephen John Smoogen
2017-08-22 17:08       ` cyg Simple
2017-08-22 17:14         ` Eliot Moss
2017-08-22 19:07           ` cyg Simple
2017-08-22 19:11             ` cyg Simple
2017-08-23 19:08               ` Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40f2498d2efcf0f5214b476c80f9cb92@mail.kylheku.com \
    --to=920-082-4242@kylheku.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).