summaryrefslogtreecommitdiff
path: root/d
diff options
context:
space:
mode:
Diffstat (limited to 'd')
-rwxr-xr-xd11
1 files changed, 11 insertions, 0 deletions
diff --git a/d b/d
new file mode 100755
index 0000000..774e969
--- /dev/null
+++ b/d
@@ -0,0 +1,11 @@
+#!/bin/bash
+[ "$1" = "$HOME" ] && echo $HOME && exit
+fl="$HOME/.local/share/dir_lst";[ ! -f "$fl" ] && touch "$fl"
+[ "$2" = "!" ] && echo "$1" && exit || \
+ln=`grep -n "$1" "$fl" | head -n 1 | cut -d : -f 1`
+if [ ! "$1" = "" ]; then if [ ! "$ln" = "" ]; then
+echo -e "$ln m0\n1p\nw"|ed -s "$fl"||echo \?; else
+l=$1; while [ ! -d "$l" ]; do echo \?; read l; done;
+l=`echo "$l" | sed "s|^[^/]|$PWD/&|"`;
+echo -e "0i\n$l\n.\n1p\nw" | ed -s "$fl"; sed -i '43,$d' "$fl"
+fi; else echo -e "2 m0\n1p\nw" | ed -s "$fl"; fi;