• esa@discuss.tchncs.de
    link
    fedilink
    arrow-up
    4
    ·
    edit-2
    4 days ago

    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”

    • LeFantome@programming.dev
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      4 days ago

      I am not much of a bash guy so it took me a moment to understand what this was doing.

      Too bad I have to read so many man pages before I get to bash or sh.

      • esa@discuss.tchncs.de
        link
        fedilink
        arrow-up
        1
        ·
        3 days ago

        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.