From 1ba877a0294a76d04802a49111692d651bd76b1e Mon Sep 17 00:00:00 2001 From: home Date: Sat, 25 Nov 2023 21:33:13 +0300 Subject: [PATCH] ls : lll fix multiple targets. --- .README.md | 2 +- .config/bash/module/ls.sh | 16 ++++++---------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/.README.md b/.README.md index aab4d11..d26bee5 100644 --- a/.README.md +++ b/.README.md @@ -534,7 +534,7 @@ Command|Description ---|--- `l`|List files in current dir. `ll`|List including hidden files. -`lll [DEPTH] [PATH]`|Show file tree. +`lll [DEPTH] [DIRS]`|Show file tree. `llll`|List everything recursively. `la`|List alphabetically. `laa`|List all alphabetically. diff --git a/.config/bash/module/ls.sh b/.config/bash/module/ls.sh index 18113f7..968af32 100644 --- a/.config/bash/module/ls.sh +++ b/.config/bash/module/ls.sh @@ -15,21 +15,17 @@ ll() } # list files in tree structure. -# usage: lll [DEPTH] [FILES] +# usage: lll [DEPTH] [DIRS] lll() { + local IFS=$'\n' local depth="${1}" - local target="${@:2}" + local target=("${@:2}") - if [[ "${target}" = "" ]]; then - target="." - fi + [[ "${target}" = "" ]] && target="." + [[ "${depth}" = "" ]] && depth=666 - if [[ "${depth}" = "" ]]; then - tree -a -- "${target}" - else - tree -a -L "${depth}" -- "${target}" - fi + tree -a -L "${depth}" -- "${target[@]}" } # list files recursively.