Compare commits
4 commits
dd90da8a82
...
aec3d1a0af
Author | SHA1 | Date | |
---|---|---|---|
aec3d1a0af | |||
efe07205fa | |||
ff5116380c | |||
a06bab3e97 |
4 changed files with 51 additions and 38 deletions
18
sh/alias/shell.sh
Normal file
18
sh/alias/shell.sh
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# shorten alias
|
||||||
|
a() {
|
||||||
|
alias \
|
||||||
|
"${@}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# swap directory (current ↔ previous)
|
||||||
|
sd() {
|
||||||
|
cd \
|
||||||
|
- ||
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
# exit terminal
|
||||||
|
x() {
|
||||||
|
exit \
|
||||||
|
"${@}"
|
||||||
|
}
|
|
@ -26,6 +26,9 @@ RWX_SELF_NAME="rwx"
|
||||||
# │ main │ variables │
|
# │ main │ variables │
|
||||||
# ╰──────┴───────────╯
|
# ╰──────┴───────────╯
|
||||||
|
|
||||||
|
# currently running shell name
|
||||||
|
RWX_SHELL="$(cat "/proc/${$}/comm")"
|
||||||
|
|
||||||
# system root directory of the project
|
# system root directory of the project
|
||||||
RWX_ROOT_SYSTEM="/usr/local/lib/${RWX_SELF_NAME}"
|
RWX_ROOT_SYSTEM="/usr/local/lib/${RWX_SELF_NAME}"
|
||||||
# user root directory of the project
|
# user root directory of the project
|
||||||
|
|
|
@ -35,13 +35,6 @@ RWX_COLOR_GREEN="$(_rwx_shell_color 31)"
|
||||||
RWX_COLOR_MAGENTA="$(_rwx_shell_color 35)"
|
RWX_COLOR_MAGENTA="$(_rwx_shell_color 35)"
|
||||||
RWX_COLOR_RED="$(_rwx_shell_color 32)"
|
RWX_COLOR_RED="$(_rwx_shell_color 32)"
|
||||||
|
|
||||||
# ╭───────┬───────────╮
|
|
||||||
# │ shell │ variables │
|
|
||||||
# ╰───────┴───────────╯
|
|
||||||
|
|
||||||
# currently running shell name
|
|
||||||
RWX_SHELL="$(cat "/proc/${$}/comm")"
|
|
||||||
|
|
||||||
# ╭───────┬───────────╮
|
# ╭───────┬───────────╮
|
||||||
# │ shell │ functions │
|
# │ shell │ functions │
|
||||||
# ╰───────┴───────────╯
|
# ╰───────┴───────────╯
|
||||||
|
@ -80,7 +73,6 @@ rwx_shell_configure() {
|
||||||
*) ;;
|
*) ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
rwx_shell_configure
|
|
||||||
|
|
||||||
rwx_shell_prompt() {
|
rwx_shell_prompt() {
|
||||||
local date host id
|
local date host id
|
||||||
|
@ -135,36 +127,12 @@ rwx_shell_prompt() {
|
||||||
printf "%b" "${view}"
|
printf "%b" "${view}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# ╭───────┬───────────╮
|
# ╭───────┬──────╮
|
||||||
# │ shell │ shortcuts │
|
# │ shell │ main │
|
||||||
# ╰───────┴───────────╯
|
# ╰───────┴──────╯
|
||||||
|
|
||||||
# shorten alias
|
rwx_shell_main() {
|
||||||
a() {
|
rwx_shell_configure
|
||||||
alias \
|
|
||||||
"${@}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# swap directory (current ↔ previous)
|
rwx_shell_main
|
||||||
sd() {
|
|
||||||
cd \
|
|
||||||
- ||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
# exit terminal
|
|
||||||
x() {
|
|
||||||
exit \
|
|
||||||
"${@}"
|
|
||||||
}
|
|
||||||
|
|
||||||
[ "${RWX_SHELL}" = "bash" ] || return
|
|
||||||
|
|
||||||
# shellcheck disable=SC3033
|
|
||||||
..() {
|
|
||||||
cd ..
|
|
||||||
}
|
|
||||||
# shellcheck disable=SC3033
|
|
||||||
...() {
|
|
||||||
cd ../..
|
|
||||||
}
|
|
24
sh/shell/bash.sh
Normal file
24
sh/shell/bash.sh
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
# ╭───────┬──────╮
|
||||||
|
# │ shell │ bash │
|
||||||
|
# ╰───────┴──────╯
|
||||||
|
|
||||||
|
if [ "${RWX_SHELL}" = "bash" ]; then
|
||||||
|
|
||||||
|
# shellcheck disable=SC3033
|
||||||
|
..() {
|
||||||
|
cd ..
|
||||||
|
}
|
||||||
|
# shellcheck disable=SC3033
|
||||||
|
...() {
|
||||||
|
cd ../..
|
||||||
|
}
|
||||||
|
# shellcheck disable=SC3033
|
||||||
|
....() {
|
||||||
|
cd ../../..
|
||||||
|
}
|
||||||
|
# shellcheck disable=SC3033
|
||||||
|
.....() {
|
||||||
|
cd ../../../..
|
||||||
|
}
|
||||||
|
|
||||||
|
fi
|
Loading…
Add table
Add a link
Reference in a new issue