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

Re: Two esoteric zsh questions



On Sep 5,  1:21pm, Jerry Peek wrote:
>
> (Is *any* zsh question esoteric?  Or are *all* zsh questions? ;-)

Both.

> 1) Can anyone explain the difference in the following two cases?  The
> first sets a shell variable; the second sets an environment variable.

Zefram answered this.

> 2) I wanted to compare the values of $whoson and $WHOSON.

You mean you wanted to see the differences, not just know whether there
are differences?  When I hear "compare the values" I think of

	[[ $whoson == $WHOSON ]]

> I couldn't think of a way to use two <<< operators

Right; if you did so, multios would concatenate the two inputs.

> 	% diff - <(echo $WHOSON) <<<$whoson
> 	%
> 
> Does anyone know a cleaner way to do that?

Aside from using "print -r --" in place of "echo", so that backslashes or
leading hyphens in $WHOSON won't cause problems, the only thing that comes
to mind is

	diff <(<<<$whoson) <(<<<$WHOSON)

which is really mostly same as

> 	% diff - <(cat <<<$WHOSON) <<<$whoson

except that zsh implements the "cat" internally, and you can give the args
in the same order that they'll appear in the diff output, which is slightly
more understandable.



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