diff options
Diffstat (limited to 'modules/common/common/shell/functions.bash')
-rw-r--r-- | modules/common/common/shell/functions.bash | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/modules/common/common/shell/functions.bash b/modules/common/common/shell/functions.bash index d947d0f..f354adb 100644 --- a/modules/common/common/shell/functions.bash +++ b/modules/common/common/shell/functions.bash @@ -1,59 +1,59 @@ function where() { - local s - s="$(type -P "$1")" - realpath "$s" + local s + s="$(type -P "$1")" + realpath "$s" } complete -F _command where function what() { - local s - s="$(where "$1")" - printf "%s\n" "${s%/*/*}" + local s + s="$(where "$1")" + printf "%s\n" "${s%/*/*}" } complete -F _command what function cat() { - if (($# == 1)) && [[ -d $1 ]]; then - ll "$1" - else - command cat "$@" - fi + if (($# == 1)) && [[ -d $1 ]]; then + ll "$1" + else + command cat "$@" + fi } function cd() { - builtin cd "$@" && - if ((${#FUNCNAME[@]} == 1)); then - ls - fi + builtin cd "$@" && + if ((${#FUNCNAME[@]} == 1)); then + ls + fi } function mkcd() { - mkdir -p "$1" && builtin cd "$1" + mkdir -p "$1" && builtin cd "$1" } function mvcd() { - mv -i -- "$PWD" "$1" && builtin cd . + mv -i -- "$PWD" "$1" && builtin cd . } function bak() { - local f - for f; do - cp -ai -- "$f" "$f.bak" - done + local f + for f; do + cp -ai -- "$f" "$f.bak" + done } function ubak() { - local f - for f; do - [[ $f == *.bak ]] || f="$f.bak" - mv -i -- "$f" "${f%.bak}" - done + local f + for f; do + [[ $f == *.bak ]] || f="$f.bak" + mv -i -- "$f" "${f%.bak}" + done } function dec2hex() { - printf "0x%X\n" "$1" + printf "0x%X\n" "$1" } function hex2dec() { - printf "%d\n" "0x$1" + printf "%d\n" "0x$1" } |