Dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

29 lines
487 B

# Shell Utitlities library
# Should work in both bash and zsh
# (c) 2014-2015 Taeyeon Mori
# I <3 predicates :)
# [predicate] Mute command
quiet() {
"$@" >/dev/null 2>&1
return $?
}
# [predicate] Colorize output
color() {
local COLOR=$1 && shift
echo -en "\e[${COLOR}m"
"$@"
local res=$?
echo -en "\e[0m"
return $res
}
# Append to array
push() {
local arr="$1"; shift
for val in "$@"; do
eval "$arr[\${#$arr[@]}]=\"\$val\""
done
}