• 1 Post
  • 5 Comments
Joined 9 months ago
cake
Cake day: December 16th, 2024

help-circle

  • Well, bash should show up quickly enough. But yeah.

    I’m also no longer much of a bash guy. Back when I was my scripts were a lot simpler, and broke in weird ways a lot more. And every time I picked up a new defensive habit, my bash became a little bit uglier, and I thought to myself “maybe I should just do this in Python”.

    But this script would be a lot longer in Python.



  • For those who want to give it a go:

    #!/bin/bash
    set -euo pipefail
    
    while read -rd ":" path
    do
      for bin in "$path"/*
      do
        # don't error out if there's no manpage
        set +e
        man "$(basename "$bin")"
        set -e
      done
    done < <(printf '%s%s' "$PATH" ":")
    

    when you get sick of it, hit ^Z (ctrl-z) and go kill %1. Then you get to start all over from the start next time!

    Bonus points for starting a tracker so you can count how long it takes to go from “eugh, what’s with that overwrought and excessively defensive bash script” to “fuck, now I’m doing it too”