2009-09-01 06:00:15 +08:00
|
|
|
function zsh_stats() {
|
|
|
|
history | awk '{print $2}' | sort | uniq -c | sort -rn | head
|
2009-09-01 06:00:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function uninstall_oh_my_zsh() {
|
2011-12-11 22:57:35 +08:00
|
|
|
/usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/uninstall.sh
|
2009-09-01 06:09:34 +08:00
|
|
|
}
|
|
|
|
|
2009-09-01 06:48:09 +08:00
|
|
|
function upgrade_oh_my_zsh() {
|
2011-12-11 22:57:35 +08:00
|
|
|
/usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh
|
2009-09-01 06:48:09 +08:00
|
|
|
}
|
|
|
|
|
2009-08-31 21:03:56 +08:00
|
|
|
function take() {
|
|
|
|
mkdir -p $1
|
|
|
|
cd $1
|
|
|
|
}
|
2010-12-25 06:20:57 +08:00
|
|
|
|
2012-05-05 16:39:05 +08:00
|
|
|
#
|
|
|
|
# Get the value of an alias.
|
|
|
|
#
|
|
|
|
# Arguments:
|
|
|
|
# 1. alias - The alias to get its value from
|
|
|
|
# STDOUT:
|
|
|
|
# The value of alias $1 (if it has one).
|
|
|
|
# Return value:
|
|
|
|
# 0 if the alias was found,
|
|
|
|
# 1 if it does not exist
|
|
|
|
#
|
|
|
|
function alias_value() {
|
|
|
|
alias "$1" | sed "s/^$1='\(.*\)'$/\1/"
|
|
|
|
test $(alias "$1")
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Try to get the value of an alias,
|
|
|
|
# otherwise return the input.
|
|
|
|
#
|
|
|
|
# Arguments:
|
|
|
|
# 1. alias - The alias to get its value from
|
|
|
|
# STDOUT:
|
|
|
|
# The value of alias $1, or $1 if there is no alias $1.
|
|
|
|
# Return value:
|
|
|
|
# Always 0
|
|
|
|
#
|
|
|
|
function try_alias_value() {
|
|
|
|
alias_value "$1" || echo "$1"
|
|
|
|
}
|