[TriLUG] happy 366th day of the year

Pete Soper via TriLUG trilug at trilug.org
Sat Jan 2 12:59:47 EST 2021


But $(date +%j) was equal to 001 yesterday, not 091, yet $? after your 
expression executed as a statement was 1. Oh wait, 1 is false, not true 
in this context. How silly of me.

-Pete


On 1/2/21 11:57 AM, Alan Porter wrote:
>
> It works the same way that [[ "$(date +%a)" == "Sat" ]] does.
> It's just a string.
>
> Bash is weird in the way that it uses a math-like == operator to 
> compare strings and a word-like -eq operator to compare numbers.
>
> Alan
>
>
>
>
> On 1/1/21 2:55 PM, Pete Soper wrote:
>> OK, the one last night was surprising, but yours is just plain weird. 
>> Is the 9 being ignored as an invalid octal digit? What's the trick 
>> that makes your expression true?
>> Pete
>>
>> Sent by my phone with an editing mind of its own
>>
>>
>> -------- Original message --------
>> From: Alan Porter via TriLUG <trilug at trilug.org>
>> Date: 1/1/21 2:32 PM (GMT-05:00)
>> To: Joseph Mack NA3T <jmack at trilug.org>, Triangle Linux Users Group 
>> General Discussion <trilug at trilug.org>
>> Subject: Re: [TriLUG] happy 366th day of the year
>>
>>
>> I thought this was a [[ $(date +%j) == "091" ]] joke.
>>
>> Alan
>>
>> -- 
>> This message was sent to: Pete Soper <pete at soper.us>
>> To unsubscribe, send a blank message to trilug-leave at trilug.org from 
>> that address.
>> TriLUG mailing list : https://www.trilug.org/mailman/listinfo/trilug
>> Unsubscribe or edit options on the web : 
>> https://www.trilug.org/mailman/options/trilug/pete%40soper.us
>> Welcome to TriLUG: https://trilug.org/welcome


More information about the TriLUG mailing list