Francesco Potorti` writes:
> How would I find that out? I did a quick test and it appears that
> maybe the following mechanism works:
>
> test / -nt / 2>/dev/null ; echo $?
>
> The above prints 1 if `-nt' is known, and a different number
> otherwise. Does that work as a rule?
>
> I think not.
>
> I'd suggest this one:
>
> t=/tmp/rcp.test.$$; touch $t; test $t -nt / 2>/dev/null; echo $?; rm -f $t
>
> It prints 0 only if -nt exists.
>
> It would be conceivable, but very unlikely, that it does not print
> 0 even if -nt is okay. That would happen if some process wrote
> into the root directory after the `touch' but before the `test'.
> Also, it could give a false negative in case the /tmp directory is
> not writable or if the temp file already existed and was not
> writable.
>
We should not be looking at return codes to assess test's abilities.
How about something like
test / -nt / 2>&1
That will be an empty string for success (supports -nt). Resist the
temptation to wrap it in `` as that will assess a sub-shell. This
should work:
(rcp-send-command ... "test / -nt / 2>&1; echo X")
... (string-match "^X$" ...) ; => success
--
Pete Forman | Disclaimer: This posting is originated by
Western Geophysical | myself and does not represent the opinion
[EMAIL PROTECTED] | of Baker Hughes or its divisions.