[issue1284] check4progs() add option to operta in silent mode
Thilo Six
bts at bts.grml.org
Sun Nov 17 14:50:51 CET 2013
Thilo Six <tech at xk2c.de> added the comment:
Excerpt from Frank Terbeck:-- <snip> --
>> 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
I tried this, same effect as before - it does not work.
I guess the reason is the same, since "emulate -L sh" isn't activated
'$ZSH_VERISON' will not be evaluated correctly.
Setting "emulate -L sh" prior to running the function in zsh fixes this.
> 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
>
> _____________________________________
> GRML issue tracker <bts at bts.grml.org>
> <http://bts.grml.org/grml/issue1284>
> _____________________________________
>
--
$ \grep -Thilo '[a-zA-Z0-9._-]\+()' ~/.bashrc
----------
assignedto: ft
files: check4progs.PATHloop, script-functions, script-functions
messages: 4670, 4671, 4672, 4673, 4674, 4675, 4676, 4677, 4678, 4679, 4682, 4683, 4684, 4685
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