Timo Sirainen <tss@iki.fi> writes:
On Thu, 2003-07-10 at 03:26, Matthias Andree wrote:
Timo Sirainen <tss@iki.fi> writes:
Oh. I guess "test -c /dev/urandom" isn't the proper way to check it then. It's not a character device with you? What OS? Maybe test -e would work.
test -e isn't implemented in Solaris' /bin/sh, so it's not an option unless you're willing to add special treatment to figure if you need to launch /usr/xpg4/bin/sh or something.
I knew there was something wrong with it :) Well, this should work then:
if test -c /dev/urandom -o -s /dev/urandom; then
Autoconf suggests using
if test -c /dev/urandom || test -s /dev/urandom ; then
Rationale: Quoting from "(autoconf.info)Limitations of Builtins":
| test' | [...] | | If you need to make multiple checks using
test', combine them with
| the shell operators &&' and
||' instead of using the test' | operators
-a' and -o'. On System V, the precedence of
-a' and
| -o' is wrong relative to the unary operators; consequently, POSIX | does not specify them, so using them is nonportable. If you | combine
&&' and ||' in the same statement, keep in mind that | they have equal precedence. | | You may use
!' with test', but not with
if': `test ! -r foo ||
| exit 1'.
-- Matthias Andree