Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: sourcing a sh file in zsh
- X-seq: zsh-workers 26420
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: sourcing a sh file in zsh
- Date: Sat, 24 Jan 2009 15:26:43 -0800
- In-reply-to: <20090124173836.64403fdc@pws-pc>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <BD9D2405-AD6A-4336-9C8A-85149165B6B8@xxxxxxxxx> <200901161939.54651.arvidjaar@xxxxxxxxxx> <090116102934.ZM22119@xxxxxxxxxxxxxxxxxxxxxx> <200901241859.30029.arvidjaar@xxxxxxxxx> <20090124173836.64403fdc@pws-pc>
On Jan 24, 5:38pm, Peter Stephenson wrote:
} Subject: Re: sourcing a sh file in zsh
}
} You need quotes for defining functions in an
} emulation, or to creating a separate file.
Yeah, that was one of my reasons for pondering making it a reserved
word or the like.
} Hmm... I wonder if we should allow code from stdin
That'd at least need another option, otherwise "emulate -E" would always
read standard input, which would be bad if it appeared in a script and
started evaluating whatever was written at it.
} for things like:
}
} emulate -LRE sh <<HERE
} function foo {
} ...
} }
} HERE
You can always do
emulate -LRE sh $(<<-\HERE
function foo {
...
}
HERE)
I'm not sure offhand if you could double-quote all of that, easily ...
} There's still the issue of retaining the emulation mode for functions
} defined in that mode; I agree we really ought to tackle that to make
} the new functionality properly useful. I expect Bart has ideas on the
} next step; how far will we need to go?
I refer you to workers/26336 where Phil makes some comments about how
he'd modify the wordcode to handle this.
} [...] we could set a global flag while the "emulate" eval is being
} run that the mode flag for a function needs to be inherited from the
} emulation. Would this need another flag to "emulate", or would it be
} good enough always to inherit the emulation mode when "emulate -E" is
} in effect?
I think the latter.
} I don't think functions should *always* inherit the emulation because
} it changes the current behaviour too much---we would be resetting a
} whole load of options before every function call.
I agree.
} I would guess we don't want to apply it to autoloaded functions which
} already have their own rules.
Also agreed, which would imply:
} We do need to be quite clear on the rules to avoid tying ourselves in
} knots with things like "emaulate -LRE sh autoload foo". "foo", in my
} interpretation, would not inherit sh behaviour here.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author