Subject: Wrong teaching on shell conditions
Posted By: aminm Post Date: 4/3/2005 11:49:39 AM
On page 32 on shell conditions the authors suggest that the trailing ] is also added just for readability. This is wrong and an opening '[' must be followed by a closing one ']'. Following the discussion, a weird example is added:
ls -l /usr/bin [
which makes no sense at all and just produces an error message that the file '[' was not found!
Reply By: jaymz Reply Date: 10/1/2005 6:33:14 AM
this is not wrong. you have an extra space in your command. try it with no space between the slash and bracket:

--- cut ---
# ls -l /usr/bin/[
-rwxr-xr-x  1 root root 22132 Aug  6 23:36 /usr/bin/[
--- cut ---

Reply By: buckersher Reply Date: 9/27/2006 9:45:57 AM
Aminm:

The command "ls -l /usr/bin/[" is not an example at all of using the open bracket.  The author is just proving that the close bracket is not needed by showing that the '[' is merely a symlink to the test command.

Murdock

Go to topic 50305

Return to index page 163
Return to index page 162
Return to index page 161
Return to index page 160
Return to index page 159
Return to index page 158
Return to index page 157
Return to index page 156
Return to index page 155
Return to index page 154