zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: activate alias inside subshell
Date: Sun, 8 Apr 2018 13:18:14 -0700	[thread overview]
Message-ID: <180408131814.ZM7928@torch.brasslantern.com> (raw)
In-Reply-To: <c046e21b-ea69-a757-269f-f8493ae47912@eastlink.ca>

On Apr 8,  7:56am, Ray Andrews wrote:
}
} Is 'zsh -f' the answer to the above -- a truly clean test of something?

The first thing asked following most bug reports is "can you reproduce
this from zsh -f?"  So yes.  Start from -f and then load the minimum
number of changes to try what you want to try (e.g., add extendedglob
if necessary, zmodload zsh/parameter or other required modules, etc.).
 
} So:
} 
} $ alias msg ... ; test2 () { msg }
} 
} and:
} 
} $ alias msg ...
} $ test2 () { msg }
} 
} ... are very different!  In the former the alias is 'pending' in the 
} latter, it is active, yes?  That's easy not to know.

Yes, that's correct.  "alias" is really intended only to make interactive
shells easier (reduce typing), not to abbreviate scripts (even if the
script is going to be used interactively later).

} BTW, results are hugely different if the redefined message function is 
} redefined with or without 'function' prepended: " function msg () ... " 
} vs. " msg () ... ".  Most comments found on the internet suggest there 
} should be no difference

There's no difference when "msg" is not an alias.  But in
    msg() ...
the word "msg" is in command position and therefore subject to alias
expansion, whereas in
    function msg () ...
it is *not* in command position and will not be alias-expanded.


  reply	other threads:[~2018-04-08 20:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-06 16:29 Ray Andrews
2018-04-07 19:57 ` Ray Andrews
2018-04-08  7:39   ` Bart Schaefer
2018-04-08 14:56     ` Ray Andrews
2018-04-08 20:18       ` Bart Schaefer [this message]
2018-04-08 20:54         ` Ray Andrews
2018-04-08 22:38       ` Ray Andrews
2018-04-09  4:11         ` Ray Andrews

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=180408131814.ZM7928@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).