From bc2772d47015d69ddb35c3cfb034aae66dabdd7a Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Wed, 13 Apr 2022 17:08:29 -0500 Subject: Add functions --- bash/functions.bash | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'bash') diff --git a/bash/functions.bash b/bash/functions.bash index de6c37a..cce92be 100644 --- a/bash/functions.bash +++ b/bash/functions.bash @@ -9,3 +9,22 @@ memq() { # memq ITEM ARRAY done return 1 } + +rebashrc() { # rebashrc + ## Reload ~/.bashrc + printf "Loading ~/.bashrc..." >&2 + if source "$HOME/.bashrc"; then + echo "OK." >&2 + else + echo "ERROR!" >&2 + fi +} + +first_which() { # first_which COMMAND... + ## Return the fully-qualified path of the first COMMAND found in $PATH. + while :; do + command -v "$1" && break + [ -z "$1" ] && return 1 + shift + done +} -- cgit 1.4.1-21-gabe81