[issue1284] check4progs() add option to operta in silent mode
Frank Terbeck
bts at bts.grml.org
Sun Nov 17 14:41:46 CET 2013
Frank Terbeck <ft at grml.org> added the comment:
Thilo Six wrote:
> That is nice! I added back the logic to suppress output at user will.
>
> BUT the funny thing with this is it does work in bash but not in zsh. :/
>
> e.g.:
> ~ % which cp
> /bin/cp
> ~ % check4progs foo cp
> foo: binary not found
> cp: binary not found
>
> This is with unmodfied debian zsh. I guess some "setopt" is missing here?
Ah yes. Good catch.
The reason for this is, that zsh in its native mode of operation is very
much *not* a POSIX shell (in particular, $foo is by default expanded as
if you wrote "$foo" in a POSIX shell). Add the following line right at
the top of the function. It'll enable zsh's POSIX-emulation mode locally
in the function:
[ -n "$ZSH_VERISON" ] && emulate -L sh
That should do the trick. The code should otherwise run in everything,
that has ‘local’ functionality, which is basically every other POSIXly
looking shell (like bash, ksh93, (d)ash, mksh, pksh, posh etc).
Regards, Frank
----------
assignedto: ft
files: check4progs.PATHloop, script-functions, script-functions
messages: 4670, 4671, 4672, 4673, 4674, 4675, 4676, 4677, 4678, 4679, 4682, 4683, 4684
nosy: Xk2c, ft
priority: wish
status: chatting
title: check4progs() add option to operta in silent mode
_____________________________________
GRML issue tracker <bts at bts.grml.org>
<http://bts.grml.org/grml/issue1284>
_____________________________________
More information about the Bugs-changes
mailing list