various additions from sim laptop

This commit is contained in:
Alexander Gehrke 2025-05-08 13:55:52 +02:00 committed by Alexander Roso
parent 912a3282c5
commit 21e41141ef
13 changed files with 645 additions and 28 deletions

View file

@ -0,0 +1,20 @@
_cdup() {
local dir=$1; shift
local targets=("$@")
for target in $targets; do
if [[ -e $dir/$target ]]; then
cd $dir
return 0
fi
done
if [[ $dir == "/" ]]; then return 1
else _cdup ${dir:h} ${targets[@]}
fi
}
cdup() {
if [[ ${#@} -gt 0 ]]; then _cdup ${PWD:h} "$@"
else _cdup ${PWD:h} .git .hg package.json build.sbt
fi
}