this is too useful to leave down in the version control library; it
turns the Nth pipe status into the current return value, allowing
simpler and more readable checking of status.
abstracted from version control library into core functions file.
also dropping the two test files for checkin.
+ # returns true if the variable is an array.
function is_array() {
[[ "$(declare -p $1)" =~ "declare -a" ]]
}
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 $?
}
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.
##############
# displays the value of a variable in bash friendly format.
+++ /dev/null
-testing a file added diff
+++ /dev/null
-testing a file added diff
#hmmm: move this to core
# this makes the status of pipe N into the main return value.
#hmmm: move this to core
# this makes the status of pipe N into the main return value.
-function promote_pipe_return()
-{
- ( exit ${PIPESTATUS[$1]} )
-}
+#function promote_pipe_return()
+#{
+# ( exit ${PIPESTATUS[$1]} )
+#}