summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Vertes <mvertes@free.fr>2025-04-17 21:19:07 +0200
committerMarc Vertes <mvertes@free.fr>2025-04-17 21:19:07 +0200
commitba6dd3256c9508ed0c71c7f3346d910803d54a46 (patch)
tree0a9481d520bd190fa4085934714bbfb987122be1
parent932179c84fd566d821e05da91c4924d7cb0e591f (diff)
update
-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; }