summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bashrc1
-rwxr-xr-xbin/cle9
2 files changed, 9 insertions, 1 deletions
diff --git a/.bashrc b/.bashrc
index 4f1e100..9870d56 100644
--- a/.bashrc
+++ b/.bashrc
@@ -51,6 +51,7 @@ export LESS=iXFRx4
# Stopwatch
alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date'
+alias fd='find . -iname'
alias grep='grep -i --color'
alias more='less'
alias vi='vim'
diff --git a/bin/cle b/bin/cle
index 1ff9dd0..b26d8b7 100755
--- a/bin/cle
+++ b/bin/cle
@@ -2,7 +2,14 @@
clip() { print "$1" | tee /dev/tty | head -n 1 | pbcopy; }
-del() { rm -i ~/.cle/"$1"; }
+checkpath() { set -- $(realpath "$1"); [ "${1#~/.cle/}" != "$1" ]; }
+
+del() {
+ set -- ~/.cle/"$1"
+ checkpath "$1" || die "invalid path $1"
+ rm -i "$1"
+ rmdir -p "${1%/*}" 2>/dev/null || true
+}
die() { echo "$@" >&2; exit 1; }