diff options
| author | Tslil Clingman <hiato1@gmail.com> | 2013-08-31 17:50:30 +0200 |
|---|---|---|
| committer | Tslil Clingman <hiato1@gmail.com> | 2013-08-31 17:50:30 +0200 |
| commit | 44365dab5497638deb7eccb4a3266e4eeafbf26a (patch) | |
| tree | 3cba029e19b8c8a276de12004030af24e9534324 /ce | |
| parent | f2b32d25177be465c7209072eb93ae14fc16dfa3 (diff) | |
tweaks
Diffstat (limited to 'ce')
| -rwxr-xr-x | ce | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1,13 +1,13 @@ # Smart directory changer using the power of grep ;) -# source in a function j() { cd `d $*`} or some such +# source in a function j() { . ce $*} or some such #!/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 +cd `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; +l=`echo "$l" | sed "s|^[^/]|$PWD/&|"`; cd $l +echo -e "0i\n$l\n.\nw" | ed -s "$fl"; sed -i '43,$d' "$fl" +fi; else echo -e "2 m0\nw" | ed -s "$fl"; fi; |
