From b417d8f415c36384434b428fe1f8a0c1b9f76eda Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Sun, 17 Nov 2024 17:13:23 +0100 Subject: [PATCH] Add environment variable sorting to crash handler --- bashutils.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/bashutils.sh b/bashutils.sh index be98711..8cc30c9 100755 --- a/bashutils.sh +++ b/bashutils.sh @@ -95,10 +95,24 @@ Issuer -> Message: ${*} Operating system -$(if [ -f "/etc/os-release" ]; then cat "/etc/os-release" | while read -r line; do echo " -> ${line}"; done; else echo "/etc/os-release does not exist"; fi) +$( + if [ -f "/etc/os-release" ]; then + # /etc/os-release file is likely + # already sorted so don't sort here + cat "/etc/os-release" | while read -r line; do + echo " -> ${line}" + done + else + echo "/etc/os-release does not exist" + fi +) Environment -$(env | while read -r line; do echo " -> ${line}"; done) +$( + env | sort - | while read -r line; do + echo " -> ${line}" + done +) Stacktrace $(for index in $(seq 0 1000); do if [ -z "$(caller "${index}")" ]; then break; else echo " -> $(caller "${index}")"; fi; done)