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
468 B
29 lines
468 B
10 years ago
|
# 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"
|
||
|
"$@"
|
||
|
echo -en "\e[0m"
|
||
|
return $?
|
||
|
}
|
||
|
|
||
|
# Append to array
|
||
|
push() {
|
||
|
local arr="$1"; shift
|
||
|
|
||
|
for val in "$@"; do
|
||
|
eval "$arr[\${#$arr[@]}]=\"\$val\""
|
||
|
done
|
||
|
}
|