Am I the only one that never, ever uses getopt/getops in shell scripts?

Just writing your own argument parser seems so much easier to do. :/

#Unix #shell #bash #ShellScripts #ShellScripting

Haack's Networking - Informal Hacking Session #03

1) Today's agenda is rsnapshot script/stack migration from backup 8700 machine to 7920, i.e., to backup the backup.

2) Write the article for the bind9 authoritative DNS server.

3) If time and/or stamina permits, we will work on this month's timbre post where I cover my month's listening history.

Live Steam w/ Chat: https://content.haacksnetworking.org/w/byjvKm4LXLLn7q4ngYaG8f

#livestream #live #gnulinux #sysadmin #floss #freesoftware #rsync #rsnapshot #shellscripts

The more I adapt #chezmoi for my setup (will still take ages!), the more I like this tool. 👍

All of my special requirements could be addressed so far in a clean/reasonable way. And I do have plenty weird requirements. 🤓

It's made for #dotfile management but it is more versatile than that. For example, I'll manage most (if not all) of my personal #shellscripts with that as well.

Had a blog post do really well this month, unexpectedly gave a talk at @longhorn, learned some lessons about tech and US fascism, and clicked some more links. My notes from October 2025: https://evanhahn.com/notes-from-october-2025/

#USPol #programming #ShellScripts #PHP #ICE

Notes from October 2025

Had a blog post do really well this month, unexpectedly gave a talk at a PHP conference, learned some lessons about tech and US fascism, and clicked some more links this October.

Parámetros Línea de Comandos. Bash

{ROOR} Revista On-line Occam's Razor

Published a big list of scripts I've written over the years: "copy" and "pasta" for working with the clipboard, "getsong" to download music, "murder" for stopping processes, and dozens more: https://evanhahn.com/scripts-i-wrote-that-i-use-all-the-time/

#programming #terminal #scripting #ShellScripts

Scripts I wrote that I use all the time

I've written a number of little scripts over the years, many of which I use every day. Here's a little collection.

Mostly, when I'm writing #ShellScripts, I use #BASH. However, sometimes, a script that works just fine on my desktop will fail when run from within a #Docker #container. So, I'll use #podman to fire up the selected container to debug my script within (like so):

podman run -it --entrypoint /bin/sh docker.io/python:3.12-alpineUsually, the problem with my script is that it wants BASH but, particularly Alpine-based containers, only have #ASH. So, I'll have to re-work my script to be ASH-compatible (which usually means a script that's a lot less terse).

In the helpful shell functions department:

(Requires bc to be installed)

load() { local load=$(uptime |sed -E "s/^.*load averages?: //; s/,.*$//") local uname="$(uname)" local cpus if [[ $1 == -q ]]; then echo "$load" elif [[ $1 == -i ]]; then echo "$load + 0.5" |bc -l |cut -f1 -d. else case "$uname" in Linux) cpus=$(grep -c ^processor /proc/cpuinfo);; *BSD) cpus=$(sysctl hw.ncpu |tr -dc "0-9\n");; *) warn "load(): assuming 1 cpu, don't know how to get the number in \"$uname\"" cpus=1;; esac local loadPerCPU=$(echo "scale=3; $load / $cpus" |bc -l |sed 's/^\./0./') echo "$load ($loadPerCPU per processor ($cpus))" fi }

#ShellScripting #UnixShell #ShellScripts #bash #ksh #sh

Linux Geek Rambling And Showing Off About Tools Use In Day To Day Basis 2025_06_18_02:23:45

YouTube