[issue1279] check4progs() does not work correctly with more then one argument

Thilo Six bts at bts.grml.org
Wed Nov 6 18:20:35 CET 2013


Thilo Six <tech at xk2c.de> added the comment:

Hello Frank,


Excerpt from Frank Terbeck:

-- <snip> --
>> +    \which "$arg" >/dev/null 2>&1 || RC="$arg"
> 
> I'm unsure about the portability of "\which". Maybe better
> 
>   builtin which "$arg" ...

It seems 'which' is only in zsh a builtin:

$ which which
which is aliased to `builtin type -all'
which is /usr/bin/which
which is /bin/which

Not sure if that is important for grml in regard to portability.

>> +    if [ -n "$RC" ] ; then
>> +      echo "$RC not installed"
>> +      RC=''
> 
> I think we can do completely without this pesky "$RC" variable. How about:

-- <snip> --

> I don't think using return values up to 255 is too portable.
> IIRC, bash, dash and zsh use values up to 127 and use the stuff above
> to signal return from program by fatal SIGNAL.
> 
> So, I'd just return "1".

-- <snip> --

> Explicit "return" is also something that I like! :)
> 
> I think my remarks should work and improve portability. Please take them into
> consideration.  Other than that, thanks for taking in interest into grml!

Attached is the bash version of check4progs() which i used now for quite some
time. dash knows "shift", so i imagine zsh will do, too.


> 
> Regards, Frank
> 
> ----------
> nosy: +ft
> 
> _____________________________________
> GRML issue tracker <bts at bts.grml.org>
> <http://bts.grml.org/grml/issue1279>
> _____________________________________
> 



-- 
$ \grep -Thilo '[a-zA-Z0-9._-]\+()' ~/.bashrc

----------
assignedto: ft
files: check4progs.mod, check4progs.mod
messages: 4640, 4641, 4663, 4664
nosy: Xk2c, ft
priority: wish
status: chatting
title: check4progs() does not work correctly with more then one argument

_____________________________________
GRML issue tracker <bts at bts.grml.org>
<http://bts.grml.org/grml/issue1279>
_____________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: check4progs.mod
Type: audio/x-mod
Size: 410 bytes
Desc: not available
URL: <http://ml.grml.org/pipermail/bugs-changes/attachments/20131106/2d4b4709/attachment.bin>


More information about the Bugs-changes mailing list