zsh-workers
 help / color / mirror / code / Atom feed
From: Michael Wardle <michael@endbracket.net>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: zsh-workers@sunsite.dk
Subject: Re: problem redeclaring path variable (ksh incompatibility)
Date: Fri, 18 Mar 2005 08:42:57 +1100	[thread overview]
Message-ID: <4239F9E1.5070009@endbracket.net> (raw)
In-Reply-To: <1050317165007.ZM32408@candle.brasslantern.com>

Hi Bart

Thanks for your reply.

> Try running your test script with ARGV0=sh in the environment and note
> the difference in behavior.

It didn't appear to make any difference.  Are you sure this hides $path, 
or are you just suggesting this should be the normal way to invoke zsh 
any time I want it to conform closely to POSIX shell?

In any case, thanks for pointing out that feature.  I discovered this 
difference when asking zsh to read my general POSIX/Korn shell .shrc, so 
it is clear I should enable any sh/ksh compliance features before doing 
so.  I'll definitely investigate it some more.

> } It turns out that neither "typeset path=" nor "typeset path=value" 
> } create a local scalar, which doesn't meet my expectations.  Strangely, 
> } however, "typeset path" does.
> 
> No, it doesn't.  Nowhere in your test script is $path a scalar.

I had assumed it was since subsequent attempts to assign scalar (string) 
values to it succeed, and its global value is restored outside of the 
function.

So this works:
typeset path
path=
path="scalar"

But this doesn't:
typeset path=
path="scalar"

And neither does this:
typeset path=""
path="scalar"

> zsh% func() { emulate ksh; typeset path ; path=scalar ; typeset path }
> zsh% func
> path=(scalar)

Assuming a -m flag to the final typeset, this certainly verifies what 
you said.

Thanks


  parent reply	other threads:[~2005-03-17 21:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-17 14:31 Michael Wardle
2005-03-17 16:50 ` Bart Schaefer
2005-03-17 17:28   ` Bart Schaefer
2005-03-17 21:42   ` Michael Wardle [this message]
2005-03-18  2:42     ` Bart Schaefer
2005-03-18 10:52   ` Peter Stephenson

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=4239F9E1.5070009@endbracket.net \
    --to=michael@endbracket.net \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@sunsite.dk \
    /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).