commit 0a046396cb50b910b505fbd85552af508f983fd8 from: Thomas Adam date: Tue Jul 12 07:53:53 2022 UTC portable: regress: fix sed parsing When making sed's command-line flags portable, don't split on $@ before parsing it, as this won't preserve the original string which needs passing to sed unmodified if it's never had to be changed. commit - c1233c7fd72e99312b77804f7decb19236efd914 commit + 0a046396cb50b910b505fbd85552af508f983fd8 blob - 2acacf973e376511c10a697abac71b65f8c16ba2 blob + 2a5f020704ba0327fb8f98a3b3fd6d02b1c49edc --- regress/cmdline/common.sh +++ regress/cmdline/common.sh @@ -72,10 +72,7 @@ sed() # Therefore, scan the argument list and remove "-i ''", replacing it # with just "-i". - original_cmd="$@" [ "$PLATFORM" = "linux" ] && { - set -- "$@" - for w in "$@" do [ "$w" = "-i" ] && { @@ -87,12 +84,12 @@ sed() # Move past -i and '' shift 2 - command "$SEDCMD" -i $@ + command "$SEDCMD" -i "$@" return } done } - command "$SEDCMD" $original_cmd + command "$SEDCMD" "$@" }