diff options
| author | Tslil Clingman <hiato1@gmail.com> | 2015-02-02 17:01:34 +0200 |
|---|---|---|
| committer | Tslil Clingman <hiato1@gmail.com> | 2015-02-02 17:01:34 +0200 |
| commit | 835d4fbcd1261908b3ef6b82055dafecfa4fd4b0 (patch) | |
| tree | f9ab70860967c109f44ffb552f2010180668d2bd | |
| parent | b4194e2e13eb50f5b5e354937453723be2756ad0 (diff) | |
Fixed trailing / bug
| -rwxr-xr-x | ce | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh # 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 @@ -8,7 +8,7 @@ fl="$HOME/.local/share/dir_lst"; [ ! -f "$fl" ] && touch "$fl" 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=$1; while [ ! -d "$l" ]; do echo \?; read l; [ ${l:(-1)} != / ] && l+=/; done; 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; |
