dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martijn Dekker <martijn@inlv.org>
To: dash@vger.kernel.org
Subject: Re: dash unset idiosyncrasies
Date: Mon, 06 Jul 2015 05:23:16 +0200	[thread overview]
Message-ID: <5599F4A4.2040403@inlv.org> (raw)
In-Reply-To: <CAPxz1+Zuye=Oj=tWvto9_ir5XcgazBY=2asesR77qRrFuTbc2A@mail.gmail.com>

Parke schreef op 06-07-15 om 04:18:
> The man page does not say what happens if the given name corresponds
> only to a function.

Neither does POSIX, as you've found out: "[...] if a variable by that
name does not exist, it is unspecified whether a function by that name,
if any, shall be unset." I agree the dash man page could do with
clarifying this.

I've found it best, to avoid bugs and confusion, to always use 'unset'
with either the -v or the -f option (but not both). This should work
consistently on all POSIXly shells.

FYI, other shells produce similar output for your test script (except
AT&T ksh halts execution on 'unset' without parameters.) There seem to
be no shells that support unsetting both variables and functions with a
single 'unset' command.

- Martijn


  reply	other threads:[~2015-07-06  3:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-06  2:18 dash unset idiosyncrasies Parke
2015-07-06  3:23 ` Martijn Dekker [this message]
2015-07-06 16:02 ` Parke

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=5599F4A4.2040403@inlv.org \
    --to=martijn@inlv.org \
    --cc=dash@vger.kernel.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.
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).