mirror of
https://codeberg.org/vlw/dotfiles.git
synced 2025-09-13 19:03:40 +02:00
fix(bash): l* dirname if file not found
This commit is contained in:
parent
943927567f
commit
865e40961a
1 changed files with 6 additions and 6 deletions
|
@ -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")
|
||||
}
|
||||
|
||||
.. () {
|
||||
|
|
Loading…
Add table
Reference in a new issue