X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=scripts%2Fcore%2Ffunctions.sh;h=a8e00f22364fa04386eabd7b8ef82289806ff661;hb=c7024b410857b8f1cc727b5eae30fb79a11c5aff;hp=d1b9311e5a9a6ad916a7d341cfa1b462fd1b0dda;hpb=4e0d105164d48387cb49d71a695bfed9a94b8221;p=feisty_meow.git diff --git a/scripts/core/functions.sh b/scripts/core/functions.sh index d1b9311e..a8e00f22 100644 --- a/scripts/core/functions.sh +++ b/scripts/core/functions.sh @@ -40,15 +40,25 @@ if [ -z "$skip_all" ]; then cd "$1" } + # returns true if the variable is an array. function is_array() { [[ "$(declare -p $1)" =~ "declare -a" ]] } + # returns true if the name provided is a defined alias. function is_alias() { alias $1 &>/dev/null return $? } + # makes the status of pipe number N (passed as first parameter) into the + # main return value (i.e., the value for $?). this is super handy to avoid + # repeating the awkward looking code below in multiple places. + function promote_pipe_return() + { + ( exit ${PIPESTATUS[$1]} ) + } + ############## # displays the value of a variable in bash friendly format.