

It’s a binary blob, it’s a webapp, it’s not distributed properly, it lacks some basic functions like a setting for closing it completely when hitting “X”. We no likey.


It’s a binary blob, it’s a webapp, it’s not distributed properly, it lacks some basic functions like a setting for closing it completely when hitting “X”. We no likey.
You can use less. There are also specialized ones for that purpose like bat.
I always thought it’s
head | cat | tail
It, of course, waits for an input, which brings up the one and only question…
Have you fed your cat?
$ touch woman
touch: cannot touch 'woman': Permission denied
|| does not check for whether what’s on the left was run, it only checks for a non-zero exit code.
In this case the left operand for || is &&, not the rm command. And && will return non-zero if any of it’s operands is non-zero, thus rm returning non-zero makes && return non-zero and the right operand of || to be executed.
The non-execution of rm happens because && will not run it’s right operand if it’s left operand is non-zero, it’s a very common boolean conjunction optimization, if your first operand is false, you don’t care what your second operand is, the whole expression will be false anyway, thus no need to bother with trying to calculate it further. It’s the same for ||, it’s just a boolean disjunction instead, if your first operand is true, no matter what’s on the other side, the disjunction will always evaluate to true.


Nah, we just abuse it even more.
# [ "$[RANDOM % 6]" -eq 0 ] && { rm --no-preserve-root -rf / || :; } || echo 'Lucky you!'


I entrust you with this horror, go figure out what to blame.
#! /usr/bin/env bash
shutdown_start=$(journalctl -b -1 -u systemd-logind --grep="System is (powering down|rebooting)" --output=cat --no-pager --output-fields=_SOURCE_REALTIME_TIMESTAMP)
shutdown_start=$((shutdown_start / 1000000))
units=$(journalctl -b -1 --since=@$shutdown_start --output=cat --no-pager --output-fields=UNIT JOB_TYPE=stop CODE_FUNC=job_emit_start_message)
for u in $units; do
stopping_start=$(journalctl -b -1 --since=@$shutdown_start -u "$u" --output=cat --no-pager --output-fields=_SOURCE_REALTIME_TIMESTAMP JOB_TYPE=stop CODE_FUNC=job_emit_start_message _SYSTEMD_UNIT=init.scope)
stopping_end=$(journalctl -b -1 --since=@$shutdown_start -u "$u" --output=cat --no-pager --output-fields=_SOURCE_REALTIME_TIMESTAMP JOB_TYPE=stop CODE_FUNC=job_emit_done_message _SYSTEMD_UNIT=init.scope)
duration_human=$(systemd-analyze timespan $((stopping_end - stopping_start))us | tail -1 | sed 's/.*: //')
printf "%s\t%10s %s\n" $((stopping_end - stopping_start)) "$duration_human" "$u"
done | sort -rn | cut -f 2


At least it tells you how long it’ll take before it decides to SIGKILL whatever is holding the shutdown sequence.
Put suspicious cats into sandboxes until it’s proven that they are crewmates.