diff --git a/sh/alias/shell.sh b/sh/alias/shell.sh new file mode 100644 index 0000000..8f6684c --- /dev/null +++ b/sh/alias/shell.sh @@ -0,0 +1,30 @@ +# shorten alias +a() { + alias \ + "${@}" +} + +# swap directory (current ↔ previous) +sd() { + cd \ + - || + return +} + +# exit terminal +x() { + exit \ + "${@}" +} + +# shellcheck disable=SC2154 +[ "${SH_SHELL}" = "bash" ] || return + +# shellcheck disable=SC3033 +..() { + cd .. +} +# shellcheck disable=SC3033 +...() { + cd ../.. +} diff --git a/sh/main.sh b/sh/main.sh index 387b1b3..6369d05 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -1,4 +1,6 @@ SH_NAME="sh" +SH_SHELL="$(cat /proc/$$/comm)" +export SH_SHELL SH_ROOT="/etc/${SH_NAME}" SH_USER="${HOME}/${SH_NAME}" diff --git a/sh/sh.sh b/sh/sh.sh index a1dc2d1..39dee54 100644 --- a/sh/sh.sh +++ b/sh/sh.sh @@ -2,8 +2,6 @@ PS1="\$(shell_prompt \${?})" PS2="\ ├ " -SH_SHELL="$(cat /proc/$$/comm)" - shell_color() { local code="${1}" case "${SH_SHELL}" in @@ -121,33 +119,3 @@ shell_setup() { rm --force --recursive "${file}" ln --symbolic "${ENV}" "${file}" } - -# shorten alias -a() { - alias \ - "${@}" -} - -# swap directory (current ↔ previous) -sd() { - cd \ - - || - return -} - -# exit terminal -x() { - exit \ - "${@}" -} - -[ "${SH_SHELL}" = "bash" ] || return - -# shellcheck disable=SC3033 -..() { - cd .. -} -# shellcheck disable=SC3033 -...() { - cd ../.. -}