From 9da45266c4e82c137af9c735c2f8d954f8f6de0a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 19 Nov 2024 16:22:07 +0100 Subject: [PATCH] sh_shell --- sh/alias/shell.sh | 30 ++++++++++++++++++++++++++++++ sh/main.sh | 2 ++ sh/sh.sh | 32 -------------------------------- 3 files changed, 32 insertions(+), 32 deletions(-) create mode 100644 sh/alias/shell.sh 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 ../.. -}