zsh-users
 help / color / mirror / code / Atom feed
From: Vin Shelton <acs@alumni.princeton.edu>
To: "zsh-users@zsh.org" <zsh-users@zsh.org>
Subject: Interpret Parameter Value at Time of Function Definition
Date: Tue, 5 Sep 2017 09:47:58 -0400	[thread overview]
Message-ID: <CACeGjnVYHHZHrGcZzMeaEq-feeuG9XShK5AM9XzAs8t+W6xCZA@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 374 bytes --]

I think zsh interprets the value of a shell variable when a function is
run, but I would like to set the value when the function is read.

E.g:

$ aaa=bbb
$ function t {
    print aaa = \"$aaa\"
  }
$ t
aaa = "bbb"
$ aaa=ccc t
aaa = "ccc"

I would like to interpret $aaa at read time, so that:

    aaa=ccc t

would print:

    aaa = "bbb"

How do I do that?

Thanks,
  Vin

             reply	other threads:[~2017-09-05 13:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-05 13:47 Vin Shelton [this message]
2017-09-05 16:17 ` Daniel Shahaf
2017-09-05 20:51   ` Bart Schaefer
2017-09-05 18:21 ` Martijn Dekker
2017-09-06  3:08   ` Ray Andrews
2017-09-06  4:16     ` Bart Schaefer

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=CACeGjnVYHHZHrGcZzMeaEq-feeuG9XShK5AM9XzAs8t+W6xCZA@mail.gmail.com \
    --to=acs@alumni.princeton.edu \
    --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).