From 457aa3e1b06b9dd0b4a3f6e63a6bff6c2ea036b0 Mon Sep 17 00:00:00 2001 From: Stacy Harper Date: Tue, 11 May 2021 09:33:05 +0200 Subject: [PATCH] Open the selected file then the nexts preserving the order Signed-off-by: Stacy Harper Signed-off-by: Maarten van Gompel --- scripts/appscripts/sxmo_files.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/appscripts/sxmo_files.sh b/scripts/appscripts/sxmo_files.sh index 30ec3c7..d91e9dc 100755 --- a/scripts/appscripts/sxmo_files.sh +++ b/scripts/appscripts/sxmo_files.sh @@ -28,7 +28,8 @@ sort_loop() { while true; do # shellcheck disable=SC2086 - CHOICES="$(printf %b 'Reload\nClose Menu\nSort By\n../\n*\n'"$(ls -1p $SORT $REVERSE)")" + FILES="$(ls -1p $SORT $REVERSE)" + CHOICES="$(printf %b 'Reload\nClose Menu\nSort By\n../\n*\n'"$FILES")" DIR="$(basename "$(pwd)")" TRUNCATED="$(printf %.7s "$DIR")" if [ "$DIR" != "$TRUNCATED" ]; then @@ -46,5 +47,7 @@ while true; do echo "$PICKED" | grep "Reload" && continue [ -d "$PICKED" ] && cd "$PICKED" && continue echo "$PICKED" | grep -E '^[*]$' && sxmo_open.sh -a ./* - [ -f "$PICKED" ] && sxmo_open.sh -a "$PICKED" + if [ -f "$PICKED" ]; then + echo "$FILES" | sed -n -e "/$PICKED/,\$p" | tr '\n' '\0' | xargs -0 sxmo_open.sh -a + fi done