Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Bashing away at Unix



On 14/03/2008, Dave Brown <dagbrown@example.com> wrote:

>  When I write a shell script that starts with #!/bin/sh, I set my
>  baseline a lot lower than is probably really necessary, because I
>  believe in playing it safe rather than sorry.

Agreed.

I write conditionals like this:

if test -n "$1"; then
    # do something
fi

not this way:

if [ -n "$1" ]; then
    # do something
fi

Because one ancient /bin/sh on Solaris 7 or SunOS 2.5 did not alias []
to test. :)

-- 
Cheers,
Josh


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links