From a9f13147dd3459b0c064b5bdfc86380a15495da3 Mon Sep 17 00:00:00 2001 From: "Wu, BinX" Date: Wed, 18 Dec 2019 09:40:07 +0800 Subject: [PATCH] Bugfix: tools/sof-boot-once.sh builtin & realtive path builtin for fix typo from `${}` to `$()` `${}` is use for variable, `$()` is catch for output value here using this for confirm command type if it is builtin command for bash, so it can direct use it without to create the full command path for it relative path to add folder without start with '.' older script just focus on './relative path/script' or '/absolute path/script' style script command So add this style script command 'relative path/script' support in relative path check Signed-off-by: Wu, BinX --- tools/sof-boot-once.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/sof-boot-once.sh b/tools/sof-boot-once.sh index 718e96dd..fda5391f 100755 --- a/tools/sof-boot-once.sh +++ b/tools/sof-boot-once.sh @@ -29,7 +29,7 @@ boot_once_flag=${boot_once_flag/:*/} if [ "$#" -ne 0 ]; then # convert cmd to the cmd full path, because in the rc.local it just support PATH=/bin:/sbin:/usr/bin:/usr/sbin cmd_path=$(dirname $(which $1) 2>/dev/null) - if [ "X${cmd_path/\/*/}" == "X." ]; then #relative path + if [ "X${cmd_path/\/*/}" == "X." -o -d "$cmd_path" ]; then #relative path cd $cmd_path cmd=$PWD/$(basename $1) cd $OLD_PATH @@ -37,7 +37,7 @@ if [ "$#" -ne 0 ]; then elif [ "X${cmd_path:0:1}" == "X/" ]; then #absolute path cmd=$cmd_path/$(basename $1) shift - elif [ "${type -t $(basename $1)}" == "builtin" ]; then + elif [ "$(type -t $(basename $1))" == "builtin" ]; then #shell builtin command cmd=$(basename $1) shift else # Miss cmd_path means couldn't find this cmd in the path, so no change