oh-my-bash/plugins/bu/bu.plugin.sh
Toan Nguyen 53fb803740
OMB - Major Refactor (#39)
* OMB - Major Refactor

- Aliases and completions now works like plugins (need to enabled in .bashrc)
- Removed the compatible check in spectrum.sh, OMB now works with Bash v3.x like the old days.
- Removed core plugin, added those bash functions into base.sh and load during startup.
- Updated OSH template for new installations
- Added history config and few other stuff from #17

@TODO: Added a shell script to update old version of .bashrc to new one.

* Fixed ShellCheck issues

* Fixed ShellCheck issues
2019-01-23 03:05:32 -08:00

33 lines
726 B
Bash

#!/usr/bin/env bash
# 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
# shellcheck disable=SC2034
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
}