Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: sourcing a sh file in zsh



On 26 ÑÐÐÐÑÑ 2009 10:51:21 Bart Schaefer wrote:
>
> } For external script library (which is unaware of zsh in any
> } case) it is simple
> }
> }   emulate sh -c "setopt sticky_emulation; source
> /my/shell/library.sh"
>
> This doesn't work, does it? 

Right, because this option does not exist. Or do you mean something 
else?

> "emulate sh -c ..." does not imply a
> full setopts reset at the end of the eval, only a reset of the
> emulation mode. 

It does. This is exactly what LOCAL_OPTIONS does as well. Except 
LOCAL_OPTIONS also preserves PRIVILEGED and RESTRICTED (which does not 
seem to be documented btw). Initially I made this optional but changed 
on your request :)

> Also, are you implying that "emulate sh" would
> implictly unset that setopt, requiring that it be re-asserted inside
> the eval?
>

Oh, it was just saving extra unsetopt and localizing code :)

> It just seems so much cleaner to wrap it all up in "emulate" in the
> first place.

OK; as I already said, adding extra option to emulate is really the 
minor problem.



Messages sorted by: Reverse Date, Date, Thread, Author