From 95f52f32eb1b2b9e05c528b67eb123ffa4d33b17 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 14:58:58 +0100 Subject: [PATCH] a,sd,x,..,... --- shell/alias/shell.sh | 49 ++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/shell/alias/shell.sh b/shell/alias/shell.sh index 9c9e8e7..d6aa697 100644 --- a/shell/alias/shell.sh +++ b/shell/alias/shell.sh @@ -1,32 +1,27 @@ -# change current directory to its parent -alias ..="\ -cd \ -.. \ -" - -# change current directory to its parent’s parent -alias ...="\ -cd \ -../.. \ -" - # shorten alias -alias a="\ -alias \ -" +a() { + alias \ + "${@}" +} # swap directory (current ↔ previous) -alias sd="\ -cd \ -- \ -" - -# import source file -alias src="\ -. \ -" +sd() { + cd - || return +} # exit terminal -alias x="\ -exit \ -" +x() { + exit \ + "${@}" +} + +# back + +# shellcheck disable=SC3033 +..() { + cd .. +} +# shellcheck disable=SC3033 +...() { + cd ../.. +}