From 1ffc479787f35a78c3135c55ede7784655cda190 Mon Sep 17 00:00:00 2001 From: Peter Frangatzis Date: Tue, 19 Aug 2025 13:12:08 +0300 Subject: [PATCH] nord.tmux: Make script portable Removed bashisms that made the file unable to be run by tmux on systems where `/bin/sh` is a symlink to `dash`. Shell commands in `tmux` are `sh` commands. It only worked if your system symlinked `/bin/sh` to `bash`. To make the file even more POSIX-compliant, we would have to remove the `local` variable assignments on lines 29-31, but `dash` supports these builtins, so this should be fine. I used the tool `checkbashisms` on Arch Linux to locate the issues. --- nord.tmux | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nord.tmux b/nord.tmux index 3da21a0..c7b7bb0 100755 --- a/nord.tmux +++ b/nord.tmux @@ -1,3 +1,5 @@ +#!/bin/sh +# # Copyright (c) 2016-present Sven Greb # This source code is licensed under the MIT license found in the license file. @@ -8,7 +10,7 @@ NORD_TMUX_STATUS_CONTENT_NO_PATCHED_FONT_FILE="src/nord-status-content-no-patche NORD_TMUX_STATUS_CONTENT_OPTION="@nord_tmux_show_status_content" NORD_TMUX_STATUS_CONTENT_DATE_FORMAT="@nord_tmux_date_format" NORD_TMUX_NO_PATCHED_FONT_OPTION="@nord_tmux_no_patched_font" -_current_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +_current_dir="$(cd "$(dirname "$0")" && pwd)" __cleanup() { unset -v NORD_TMUX_COLOR_THEME_FILE NORD_TMUX_VERSION @@ -28,7 +30,7 @@ __load() { local no_patched_font=$(tmux show-option -gqv "$NORD_TMUX_NO_PATCHED_FONT_OPTION") local date_format=$(tmux show-option -gqv "$NORD_TMUX_STATUS_CONTENT_DATE_FORMAT") - if [ "$(tmux show-option -gqv "clock-mode-style")" == '12' ]; then + if [ "$(tmux show-option -gqv "clock-mode-style")" = '12' ]; then tmux set-environment -g NORD_TMUX_STATUS_TIME_FORMAT "%I:%M %p" else tmux set-environment -g NORD_TMUX_STATUS_TIME_FORMAT "%H:%M"