From 42f566ce1d13190cb4eded5fa5ae58f6f6be7dd7 Mon Sep 17 00:00:00 2001 From: "jp.av.dev" Date: Thu, 25 Aug 2022 02:54:48 -0400 Subject: [PATCH] edit otros.sh: mejora ver_imgs imgs con espacios en el nombre fix. ver otros directorios distintos a ./ --- otros.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/otros.sh b/otros.sh index 507eb85..9440f46 100755 --- a/otros.sh +++ b/otros.sh @@ -44,12 +44,18 @@ ver_imgs(){ [[ -z "${@}" ]] && dir_imgs="./" || dir_imgs="${@}" [[ ! "${dir_imgs}" =~ /$ ]] && dir_imgs+='/' if [ -d "${dir_imgs}" ] && [ "${TERM}" = "xterm-kitty" ]; then - for imagen in $(ls "${dir_imgs}"); do - img="${dir_imgs}${imagen}" + ConT=0 + OIFS="$IFS" + IFS=$'\n' + while read -a LINEA; do + [[ -r "${dir_imgs}${LINEA}" ]] && imagenes[$ConT]="${dir_imgs}${LINEA}" && ((++ConT)) + done <<< $(\ls -U "${dir_imgs}") + IFS="$OIFS" + for img in "${imagenes[@]}"; do if [ -f "${img}" ]; then shopt -s nocasematch - if [[ "${imagen}" =~ \.(jpe?g|png|svg|webp|gif|ico|bmp|tiff?)$ ]]; then - printf 'Imagen: [%b%s%s%b]\n' "${GRn}" "${dir_imgs}" "${imagen}" "${RST}" + if [[ "${img}" =~ \.(jpe?g|png|svg|webp|gif|ico|bmp|tiff?)$ ]]; then + printf 'Imagen: [%b%s%s%b]\n' "${GRn}" "${dir_imgs}" "${img}" "${RST}" kitty +kitten icat "${img}" read -p 'continuar' else @@ -221,7 +227,5 @@ metronomo() { done } -touch_exec(){ - touch "${1}" && chmod u+x ${1} && nvim ${1}; } "$@"