BTS

Message4664

Author Xk2c
Recipients ft
Date 2013-11-06.17:20:34
Content
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@bts.grml.org>
> <http://bts.grml.org/grml/issue1279>
> _____________________________________
> 



-- 
$ \grep -Thilo '[a-zA-Z0-9._-]\+()' ~/.bashrc
Files
File name Uploaded
check4progs.mod Xk2c, 2013-11-06.17:20:34
History
Date User Action Args
2013-11-06 17:20:35Xk2csetrecipients: + ft
2013-11-06 17:20:35Xk2clinkissue1279 messages
2013-11-06 17:20:34Xk2ccreate