On (info (coreutils)File type tests, and test(1) man page, we see
`-t FD'
True if FD is a file descriptor that is associated with a terminal.
Well please mention what happens if FD is omitted:
$ test -t
The answer is it always returns true, no matter what. Test with
$ echo 'set -x; for i
[EMAIL PROTECTED] wrote:
On (info (coreutils)File type tests, and test(1) man page, we see
`-t FD'
True if FD is a file descriptor that is associated with a terminal.
Well please mention what happens if FD is omitted:
bash's help test explains this, if you know where to look:
Paul Jarc wrote:
Similar language is in bash's man page and coreutils' info
documentation. But it wouldn't hurt to add a note to indicate that if
no operand is provided, then -t and other operators stop being
operators, and are tested as plain strings.
This is covered in the man page and
Is this a bug?
$ t=test #bash builtin
$ $t -t ' '; echo $?
0
PJ That looks like a bug. bash tries to parse a number from the
PJ string and ends up with zero, which is a tty.
[EMAIL PROTECTED] wrote:
Is this a bug?
$ t=test #bash builtin
$ $t -t ' '; echo $?
0
Doesn't look like it:
$ ../bash-3.2-patched/bash --version
GNU bash, version 3.2.39(3)-release (i386-apple-darwin9.2.0)
Copyright (C) 2007 Free Software Foundation, Inc.
$ cat x19
test -t 0
echo $?
test
Configuration Information [Automatically generated, do not change]:
Machine: i486
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i486'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale'