Share your SOTD for Monday!

  • walden@sub.wetshaving.socialM
    link
    fedilink
    arrow-up
    6
    ·
    19 days ago

    March 31, 2025

    This is the first daily post made by cronjob using a little script I put together. It worked!

    It was too difficult to figure out how to get it to say “31st” instead of “31”, for example, but other than that it’s cool. We still have that counter, plus I’m also able to mention the day of the week in the body, as well as the title. It’s the little things, right?

    Great shave. You & I (Will Die) is a horrible name for a soap, but it’s a great scent.

    • snooting@sub.wetshaving.social
      link
      fedilink
      arrow-up
      5
      ·
      edit-2
      19 days ago

      Something like this would probably work (untested):

      # Get the day of month as a number
      day=$(date +%-d)
      
      # Determine the correct suffix
      case $day in
          1|21|31) suffix="st";;
          2|22) suffix="nd";;
          3|23) suffix="rd";;
          *) suffix="th";;
      esac
      
      # Print the date with the ordinal suffix
      formatted_date=$(date +"%B %-d$suffix, %Y")
      

      Another way scripting in bash kinda sucks: you can’t call off to nice easy to use libraries that make this sort of thing trivial :)