Otto Moerbeek wrote:
On Fri, Mar 14, 2008 at 09:02:19PM +1300, Richard Toohey wrote:

On 14/03/2008, at 8:31 PM, Richard Toohey wrote:
On 14/03/2008, at 8:15 PM, Erwin van Maanen wrote:
        if [ X"${dhcpd_flags}" != X"NO" -a -f /etc/dhcpd.conf ]; then
Now i have no clue what " -a -f " does (anyone care to point me to the right
manual?)
[cut]
man test
   -f file       True if file exists and is a regular file.
     expression1 -a expression2
                   True if both expression1 and expression2 are true.

Apologies to all who know this already - but I wondered about that [ file
for ages until I was enlightened.

So, if you are wondering why man test ... at the top of the man page:

SYNOPSIS
     test expression
     [ expression ]

(See the square brackets?)  And if you look in /bin:

$ ls -l /bin
total 13652
-r-xr-xr-x  2 root  bin   79136 Aug 29  2007 [
[cut]
-r-xr-xr-x  2 root  bin   79136 Aug 29  2007 test

man [ will take you to the test man page.

See, for example:

http://developer.apple.com/documentation/OpenSource/Conceptual/ShellScripting/shell_scripts/chapter_2_section_10.html#//apple_ref/doc/uid/TP40004268-CH237-SW4

Some background...

Originally, the shell had vitually no builtin commands, all processing
was done by external commands. Even loops were implemented by forking
a child that interpreted the condition and moved the seek position in
the shell script being executed. That could be done since fd's were
shared.
Of course that was all dog slow, and that's why more and more commands
are now executed as builtins. External version of the commands still
remain, though.

... which means that people should actually have pointed the OP top ksh(1) rather than test(1) or [(1)... :-)

/Alexander

Reply via email to