[ale] Bash confusion

Jim Lynch ale_nospam at fayettedigital.com
Thu Jul 21 04:54:03 EDT 2011


On 07/20/2011 04:46 PM, The Don Lachlan wrote:
> On Wed, Jul 20, 2011 at 04:13:39PM -0400, Geoffrey Myers wrote:
>> The Don Lachlan wrote:
>>> On Wed, Jul 20, 2011 at 03:29:42PM -0400, Al Snow wrote:
>>>> Try if [ "X01" = "X${date}" ] then if $date is empty you still have "X".
>>> That is unnecessary and confusing.
>>>
>>>    if [ "01" = "$date" ]
>>>
>>> is simpler and more clear.
>> Not that I agree with the "X01" approach, but it is a standard practice
>> throughout a lot of the scripting in Linux.
> Yes, I'm aware. Sometimes, people get paid to write unnecessary and
> confusing code. :)
>
> Personally, it's also frustrating because Al followed up to my post by
> suggesting something that I had explained was unnecessary.
>
> -L
>
I think it's an antiquated convention.  Back when I was learning the 
Bourne shell in the mid 80's, that was the way it was done.  I think the 
Bourne shell needed that extra character because it didn't handle null 
strings very well.

Jim.


More information about the Ale mailing list