diff options
author | George Abbott <george@gabbott.dev> | 2025-01-26 11:37:22 +0000 |
---|---|---|
committer | George Abbott <george@gabbott.dev> | 2025-01-26 11:37:22 +0000 |
commit | 82abadcecc7534b4847238ee2a977f33256b0439 (patch) | |
tree | ad8752c1dc9914829e80bc2f3f1a45dfec8f4b4a /scripts/sh/cdabbr | |
parent | bac748dbe8c28cf1ed3b387b24f89ffe5a58ffc9 (diff) |
sh
Diffstat (limited to 'scripts/sh/cdabbr')
-rwxr-xr-x | scripts/sh/cdabbr | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/sh/cdabbr b/scripts/sh/cdabbr new file mode 100755 index 0000000..de5dadd --- /dev/null +++ b/scripts/sh/cdabbr @@ -0,0 +1,14 @@ +#!/bin/sh +# cdabbr :: opens the `cdabbr` document for editing and reloads abbreviations +# cdabbr ls :: cats out the document +# cdabbr :: + +[ -z "$EDITOR" ] && echo "EDITOR not set" && exit + +[ "$1" = "ls" ] && cat "$HOME/cdabbr" && exit 0 + +$EDITOR "$HOME/cdabbr" + +while read a c ; do + alias "cd$a"="cd $c" +done <<< "$(cat "$HOME"/cdabbr)" |