diff --git a/sh/alias/shell.sh b/sh/alias/shell.sh deleted file mode 100644 index f216c92..0000000 --- a/sh/alias/shell.sh +++ /dev/null @@ -1,18 +0,0 @@ -# shorten alias -a() { - alias \ - "${@}" -} - -# swap directory (current ↔ previous) -sd() { - cd \ - - || - return -} - -# exit terminal -x() { - exit \ - "${@}" -} diff --git a/sh/main.sh b/sh/main.sh index 470cf72..16ce907 100755 --- a/sh/main.sh +++ b/sh/main.sh @@ -26,9 +26,6 @@ RWX_SELF_NAME="rwx" # │ main │ variables │ # ╰──────┴───────────╯ -# currently running shell name -RWX_SHELL="$(cat "/proc/${$}/comm")" - # system root directory of the project RWX_ROOT_SYSTEM="/usr/local/lib/${RWX_SELF_NAME}" # user root directory of the project diff --git a/sh/shell/0.sh b/sh/shell.sh similarity index 79% rename from sh/shell/0.sh rename to sh/shell.sh index 6a28c31..8400fd2 100644 --- a/sh/shell/0.sh +++ b/sh/shell.sh @@ -35,6 +35,13 @@ RWX_COLOR_GREEN="$(_rwx_shell_color 31)" RWX_COLOR_MAGENTA="$(_rwx_shell_color 35)" RWX_COLOR_RED="$(_rwx_shell_color 32)" +# ╭───────┬───────────╮ +# │ shell │ variables │ +# ╰───────┴───────────╯ + +# currently running shell name +RWX_SHELL="$(cat "/proc/${$}/comm")" + # ╭───────┬───────────╮ # │ shell │ functions │ # ╰───────┴───────────╯ @@ -73,6 +80,7 @@ rwx_shell_configure() { *) ;; esac } +rwx_shell_configure rwx_shell_prompt() { local date host id @@ -127,12 +135,36 @@ rwx_shell_prompt() { printf "%b" "${view}" } -# ╭───────┬──────╮ -# │ shell │ main │ -# ╰───────┴──────╯ +# ╭───────┬───────────╮ +# │ shell │ shortcuts │ +# ╰───────┴───────────╯ -rwx_shell_main() { - rwx_shell_configure +# shorten alias +a() { + alias \ + "${@}" } -rwx_shell_main +# swap directory (current ↔ previous) +sd() { + cd \ + - || + return +} + +# exit terminal +x() { + exit \ + "${@}" +} + +[ "${RWX_SHELL}" = "bash" ] || return + +# shellcheck disable=SC3033 +..() { + cd .. +} +# shellcheck disable=SC3033 +...() { + cd ../.. +} diff --git a/sh/shell/bash.sh b/sh/shell/bash.sh deleted file mode 100644 index 400f83c..0000000 --- a/sh/shell/bash.sh +++ /dev/null @@ -1,24 +0,0 @@ -# ╭───────┬──────╮ -# │ shell │ bash │ -# ╰───────┴──────╯ - -if [ "${RWX_SHELL}" = "bash" ]; then - -# shellcheck disable=SC3033 -..() { - cd .. -} -# shellcheck disable=SC3033 -...() { - cd ../.. -} -# shellcheck disable=SC3033 -....() { - cd ../../.. -} -# shellcheck disable=SC3033 -.....() { - cd ../../../.. -} - -fi