this post was submitted on 19 Aug 2025
418 points (94.3% liked)

Programming

23085 readers
165 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] syklemil@discuss.tchncs.de 4 points 1 month ago* (last edited 1 month ago) (1 children)

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 2 points 1 month ago* (last edited 1 month ago) (1 children)

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.

[–] syklemil@discuss.tchncs.de 1 points 1 month 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.