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

Re: sourcing a sh file in zsh



On 25 ÑÐÐÐÑÑ 2009 15:20:09 Bart Schaefer wrote:
>
> } Yes, I am more and more inclined to make it "-c ..."  ... OK to
> commit?
>
> I think so.
>

Committed. 

> } If you are defining function in a *zsh* script, why not simply
> define it } as *zsh* function?
>
>     emulate sh
>     # ...
>     emulate zsh -c "${$(<<\HERE
>     function ...
>     HERE)}"
>     # ...
>
> Yeah, that's a bit contrived.

Hmm ... not convinced by this example but I realize now that if sticky 
emulation is going to be implemented, it could be useful to define 
sticky *zsh* function in zsh script.

I still believe using option is the most simple and straightforward way 
to do it. 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"

and zsh script can obviously do

	setopt sticky_emulation
	function zsh_func {
		...
	}
	unsetopt sticky_emulation

Attachment: signature.asc
Description: This is a digitally signed message part.



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