Is command test equivalent to "[]"?
I see example like below, which I thought should be used with test.
Code:
[ $retval -eq 0 ] && echo "$user found" || echo "$user not found" SYNOPSIS test EXPRESSION test [ EXPRESSION ] [ ] [ OPTION |
And what happens when you do - man [
|
Quote:
Code:
NAME |
To get the help for bash built-ins, use help test etc. The man pages give information about the executables that bash uses as "externals". Mostly they work the same but not always.
|
Try reading info test too.
But catkin is right. bash has it's own internal implementation of test. And while you're there, also take a look at [[ and ((..)). |
Quote:
|
Quote:
|
Quote:
|
See here for the differences between [ and [[.
http://mywiki.wooledge.org/BashFAQ/031 ((..)) is one technique for arithmetic evaluation, which can be used instead of the regular tests when working with integers. http://mywiki.wooledge.org/ArithmeticExpression |
All times are GMT -5. The time now is 08:11 AM. |