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

Re: Apple bash to zsh script problems with error control and bash emulation



Dominik Reichardt wrote on Mon, 16 Nov 2020 16:00 +0100:
> I’ve recently moved to zsh as Apple is pressuring us :)
> 

The easiest solution is to keep the script as «#!/usr/bin/env bash»:

https://github.com/zsh-users/zsh/blob/04bd9a44a74683ad0d83921bfb3aa0c4d5992c75/Etc/FAQ.yo#L2056-L2102

> Something goes wrong in the error(), pipestatus() and teelog() functions, I guess. But I can’t quite tell and I’ve built that script 5 years ago and am a bit rusty to what each of those function do exactly.

Well, for starters, $PIPESTATUS doesn't expand to what you think it
does.

> What I expect is that when the script runs into an error it stops, even if the error happens in one of the functions but currently the script goes on and on. This used to work before in bash.

See «set -e».  You probably have it set in your bash global setup.

See also the ERR_RETURN option.

> If I get rid of the —emulate sh, my variables don’t get passed on correctly (the error I get in the shorted version of my script is "configure: error: unrecognized option: `-q --disable-data --with-macosx-static-lib-path=/opt/i386/lib’”
> 

http://zsh.sourceforge.net/FAQ/zshfaq03.html#l18




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