fix(bash): l* dirname if file not found

This commit is contained in:
Victor Westerlund 2025-05-21 09:27:08 +02:00
parent 943927567f
commit 865e40961a
Signed by: vlw
GPG key ID: D0AD730E1057DFC6

View file

@ -5,32 +5,32 @@ mkcdir () {
# Preview contents of a file or list the contents of a directory
l () {
if [ -n "$1" ] ; then
if [ -f "$1" ] ; then
less $1
return
fi
ls -lh $1
ls -lh $1 || l $(dirname "$1")
}
# Preview the contents of a file or list the contents of a directory with hidden files shown
ll () {
if [ -n "$1" ] ; then
if [ -f "$1" ] ; then
less $1
return
fi
ls -lah $1
ls -lah $1 || ll $(dirname "$1")
}
# Edit the contents of a file or list the contents of a directory (with hidden files shown) if that file is not found
lll () {
if [ -n "$1" ] ; then
if [ -f "$1" ] ; then
nano $1
return
fi
ls -lah $1
ls -lah $1 || lll $(dirname "$1")
}
.. () {