Gentoo Archives: gentoo-user

From: Richard Fish <bigfish@××××××××××.org>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] /usr/bin/test doesn't seem to do anything
Date: Fri, 27 Jan 2006 00:29:47
Message-Id: 7573e9640601261622n71053bf7p2db8f89f5ca0c398@mail.gmail.com
In Reply to: [gentoo-user] /usr/bin/test doesn't seem to do anything by Robert Persson
1 On 1/26/06, Robert Persson <ireneshusband@××××××××.uk> wrote:
2 > Someone was kind enough to send me a script that calls /usr/bin/test. When the
3 > script didn't work I realised that test was behaving strangely. Basically it
4 > doesn't seem to return anything.
5
6 test doesn't output anything...it indicates success/failure with the
7 exit code. Try the following test.sh script:
8
9 #!/bin/bash
10 /usr/bin/test "$@"
11 rc=$?
12 if test "$rc" -eq 0; then
13 echo "'test $@' was successful"
14 else
15 echo "'test $@' failed with code $rc"
16 fi
17
18 As others have said though, watch out for the 'test' command built-in
19 to many shells, as the behavior there is defined by the shell.
20 Generally though, /usr/bin/test and bash test should work the same....
21
22 -Richard
23
24 --
25 gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] /usr/bin/test doesn't seem to do anything Robert Persson <ireneshusband@××××××××.uk>