From ff8311883334b4aef63579ed9864725b8d53e448 Mon Sep 17 00:00:00 2001 From: Michel-FK Date: Wed, 9 Jun 2021 23:35:34 +0200 Subject: [PATCH] quote rom names with single quotes Signed-off-by: Michel-FK --- .../rootfs-overlay/usr/local/sbin/instant_play | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/instant_play b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/instant_play index 21aba30..ed45436 100755 --- a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/instant_play +++ b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/instant_play @@ -60,11 +60,15 @@ save) # Write quick load file args echo -n "" > "${INSTANT_PLAY_FILE}" - for arg in "$@"; do - - # Add quotes around all arguments - echo -n "'${arg}' " >> "${INSTANT_PLAY_FILE}" + while : + do + printf "'" >> "${INSTANT_PLAY_FILE}" + printf %s "$1" | sed "s/'/'\\\\''/g" >> "${INSTANT_PLAY_FILE}" + shift + case $# in 0) break; esac + printf "' " >> "${INSTANT_PLAY_FILE}" done + printf "'\n" >> "${INSTANT_PLAY_FILE}" # Add the magic sauce to launch the process in background, # record the PID into a file, wait for the process to