This commit is contained in:
Marc Beninca 2024-11-19 16:22:07 +01:00
parent 07483cdadf
commit 9da45266c4
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F
3 changed files with 32 additions and 32 deletions

30
sh/alias/shell.sh Normal file
View file

@ -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 ../..
}

View file

@ -1,4 +1,6 @@
SH_NAME="sh" SH_NAME="sh"
SH_SHELL="$(cat /proc/$$/comm)"
export SH_SHELL
SH_ROOT="/etc/${SH_NAME}" SH_ROOT="/etc/${SH_NAME}"
SH_USER="${HOME}/${SH_NAME}" SH_USER="${HOME}/${SH_NAME}"

View file

@ -2,8 +2,6 @@ PS1="\$(shell_prompt \${?})"
PS2="\ PS2="\
" "
SH_SHELL="$(cat /proc/$$/comm)"
shell_color() { shell_color() {
local code="${1}" local code="${1}"
case "${SH_SHELL}" in case "${SH_SHELL}" in
@ -121,33 +119,3 @@ shell_setup() {
rm --force --recursive "${file}" rm --force --recursive "${file}"
ln --symbolic "${ENV}" "${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 ../..
}