OT: stupid sh scripting question

Matthew Seaman m.seaman at infracaninophile.co.uk
Wed Jan 3 13:36:58 PST 2007


Robert Huff wrote:
> 	This is probably staring me in the face:
> 
> if [ ! -d "foo"] 

Missing space   ^ here.  

ie:

    if [ ! -d "foo" ]
    then
        mkdir foo
    fi

or perhaps more succinctly:

    [ -d "foo" ] || mkdir "foo"

or best of all, maybe just:

    mkdir -p "foo"

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.                       7 Priory Courtyard
                                                      Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey         Ramsgate
                                                      Kent, CT11 9PW

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 250 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20070103/f0a6ecd2/signature.pgp


More information about the freebsd-questions mailing list