From 7c9096d66616d7dd016075b569c1e8c22fdfca20 Mon Sep 17 00:00:00 2001 From: Ismo Vuorinen Date: Thu, 5 Feb 2026 20:52:34 +0200 Subject: [PATCH] fix: standardize shebangs, error handling, and minor issues in x-* scripts Normalize shebangs to #!/usr/bin/env bash (x-env-list, x-localip). Use XDG_CONFIG_HOME in x-change-alacritty-theme. Remove unused VERBOSE variable in x-multi-ping. Add set -euo pipefail to x-when-down and x-when-up. Add usage header to x-term-colors. Fix notify-call to notify-send.sh in x-record. --- local/bin/x-change-alacritty-theme | 2 +- local/bin/x-env-list | 2 +- local/bin/x-localip | 2 +- local/bin/x-multi-ping | 3 --- local/bin/x-record | 2 +- local/bin/x-term-colors | 14 ++++++++------ local/bin/x-when-down | 1 + local/bin/x-when-up | 1 + 8 files changed, 14 insertions(+), 13 deletions(-) diff --git a/local/bin/x-change-alacritty-theme b/local/bin/x-change-alacritty-theme index 9d54b66..a82d40b 100755 --- a/local/bin/x-change-alacritty-theme +++ b/local/bin/x-change-alacritty-theme @@ -8,7 +8,7 @@ set -euo pipefail # Enable verbosity with VERBOSE=1 VERBOSE="${VERBOSE:-0}" -A_DIR="$HOME/.config/alacritty" +A_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/alacritty" # Function to print usage information usage() diff --git a/local/bin/x-env-list b/local/bin/x-env-list index 0c6a30e..39061f3 100755 --- a/local/bin/x-env-list +++ b/local/bin/x-env-list @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # List environment variables grouped by the first part before underscore # protecting environment variables that possibly contain sensitive information. diff --git a/local/bin/x-localip b/local/bin/x-localip index 9f3d299..832765a 100755 --- a/local/bin/x-localip +++ b/local/bin/x-localip @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # x-localip: script to display the local IP addresses of the system # diff --git a/local/bin/x-multi-ping b/local/bin/x-multi-ping index 4f4b638..0073350 100755 --- a/local/bin/x-multi-ping +++ b/local/bin/x-multi-ping @@ -39,7 +39,6 @@ # Defaults LOOP=0 SLEEP=1 -VERBOSE=0 TIMEOUT=5 usage() @@ -60,8 +59,6 @@ while [[ $# -gt 0 ]]; do exit 0 ;; --verbose) - # shellcheck disable=SC2034 - VERBOSE=1 shift ;; --loop | --forever) diff --git a/local/bin/x-record b/local/bin/x-record index ad0f8b6..7aac9ed 100755 --- a/local/bin/x-record +++ b/local/bin/x-record @@ -35,7 +35,7 @@ msg() # Notify function notify() { - notify-call --replace-file "$replace_id" "$@" + notify-send.sh --replace-file "$replace_id" "$@" } # Stop recording function diff --git a/local/bin/x-term-colors b/local/bin/x-term-colors index 507d8c6..e12fffb 100755 --- a/local/bin/x-term-colors +++ b/local/bin/x-term-colors @@ -1,11 +1,13 @@ #!/usr/bin/env bash # -# This file echoes a bunch of 24-bit color codes -# to the terminal to demonstrate its functionality. -# The foreground escape sequence is ^[38;2;;;m -# The background escape sequence is ^[48;2;;;m -# range from 0 to 255 inclusive. -# The escape sequence ^[0m returns output to default +# Display 24-bit terminal color test. +# +# Usage: x-term-colors +# +# The foreground escape sequence is ^[38;2;;;m +# The background escape sequence is ^[48;2;;;m +# range from 0 to 255 inclusive. +# The escape sequence ^[0m returns output to default setBackgroundColor() { diff --git a/local/bin/x-when-down b/local/bin/x-when-down index 6eb2dfd..491d957 100755 --- a/local/bin/x-when-down +++ b/local/bin/x-when-down @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -euo pipefail # # Wait until a given host is down (determined by ping) then execute the # given command diff --git a/local/bin/x-when-up b/local/bin/x-when-up index 5bdb562..71e83a8 100755 --- a/local/bin/x-when-up +++ b/local/bin/x-when-up @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -euo pipefail # # Wait until a given host is online (determined by ping) then execute the # given command