diff options
| author | Tslil Clingman <hiato1@gmail.com> | 2014-12-05 11:59:55 +0200 |
|---|---|---|
| committer | Tslil Clingman <hiato1@gmail.com> | 2014-12-05 11:59:55 +0200 |
| commit | 2dc2feacf35cfebade39b2e2797e02ac6d84c4c4 (patch) | |
| tree | fb91f5b3e1bda2479686c2344bbff28a21af4d28 /ce | |
| parent | efd9525d83d25ae2cd3c308e4a6ca25fc8f5aeb1 (diff) | |
Tweaks and ratpoison window switcher
Diffstat (limited to 'ce')
| -rwxr-xr-x | ce | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -1,13 +1,14 @@ -# Smart directory changer using the power of grep ;) -# source in a function j() { . ce $*} or some such #!/bin/bash +# Smart directory changer using the power of grep ;) +# source in a function j() { ce $*; cd `head -n 1 ~/.local/share/dir_lst` } +# or some such [ "$1" = "$HOME" ] && echo $HOME && exit -fl="$HOME/.local/share/dir_lst";[ ! -f "$fl" ] && touch "$fl" -[ "$2" = "!" ] && echo "$1" && 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 -cd `echo -e "$ln m0\n1p\nw"|ed -s "$fl"` ||echo \?; else +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/&|"`; cd $l +l=`echo "$l" | sed "s|^[^/]|$PWD/&|"`; 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; |
