From 5c942c0f64847bf0d6f85c4513ab94de902e0f14 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 31 Dec 2018 13:52:25 +1300 Subject: Translate a short-circuit into a conditional I only want to use the `||` short-circuits for control flow changes (return, continue, break etc). --- sh/shrc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sh/shrc') diff --git a/sh/shrc b/sh/shrc index 808e944d..fa44892b 100644 --- a/sh/shrc +++ b/sh/shrc @@ -8,7 +8,9 @@ command -p stty -ixon -ctlecho 2>/dev/null HISTSIZE=$((1 << 12)) # If HOSTNAME isn't set by this shell, we'll do it -[ -n "$HOSTNAME" ] || HOSTNAME=$(uname -n) +if [ -z "$HOSTNAME" ] ; then + HOSTNAME=$(uname -n) +fi # Don't warn me about new mail unset -v MAILCHECK -- cgit v1.2.3 From d32e82ab7e8baef31a1edeb4bc032352dea40020 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 31 Dec 2018 13:52:49 +1300 Subject: Add clarifying comment --- sh/shrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sh/shrc') diff --git a/sh/shrc b/sh/shrc index fa44892b..26f69c0c 100644 --- a/sh/shrc +++ b/sh/shrc @@ -16,7 +16,7 @@ fi unset -v MAILCHECK # Load all the POSIX-compatible functions from ~/.shrc.d; more advanced shells -# like bash will have their own functions +# like bash will have their own functions in addition to these for sh in "$HOME"/.shrc.d/*.sh ; do [ -e "$sh" ] || continue . "$sh" -- cgit v1.2.3