未验证 提交 dd832846 编写于 作者: T tmidi

Add 'bu' function to CD up faster

上级 54554359
# bu.plugin.sh
# Author: Taleeb Midi <taleebmidi@gmail.com>
# Based on oh-my-zsh AWS plugin
#
# command 'bu [N]' Change directory up N times
#
# Faster Change Directory up
function bu () {
function usage () {
cat <<-EOF
Usage: bu [N]
N N is the number of level to move back up to, this argument must be a positive integer.
h help displays this basic help menu.
EOF
}
# reset variables
STRARGMNT=""
FUNCTIONARG=$1
# Make sure the provided argument is a positive integer:
if [[ ! -z "${FUNCTIONARG##*[!0-9]*}" ]]; then
for i in $(seq 1 $FUNCTIONARG); do
STRARGMNT+="../"
done
CMD="cd ${STRARGMNT}"
eval $CMD
else
usage
fi
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册