diff mbox

[1/1] scripts: bin2png.sh: Fix POSIX shell compliance

Message ID 1487778763-10482-1-git-send-email-kieran.bingham+renesas@ideasonboard.com (mailing list archive)
State Not Applicable
Delegated to: Geert Uytterhoeven
Headers show

Commit Message

Kieran Bingham Feb. 22, 2017, 3:52 p.m. UTC
From: Kieran Bingham <kieran.bingham@ideasonboard.com>

The string manipulations of the form ${VAR/search/replace} are not posix
compliant. Use string deletion, and append instead.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 scripts/bin2png.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Laurent Pinchart Feb. 22, 2017, 5:38 p.m. UTC | #1
Hi Kieran,

Thank you for the patch.

On Wednesday 22 Feb 2017 15:52:43 Kieran Bingham wrote:
> From: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> The string manipulations of the form ${VAR/search/replace} are not posix
> compliant. Use string deletion, and append instead.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

Reviewed-by, applied and pushed.

> ---
>  scripts/bin2png.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/bin2png.sh b/scripts/bin2png.sh
> index 090f31fa992d..6422ee51bc33 100755
> --- a/scripts/bin2png.sh
> +++ b/scripts/bin2png.sh
> @@ -4,8 +4,8 @@ FILE=${1:-.}
> 
>  convert_image() {
>  	local file=$1
> -	local pnm=${file/%bin/pnm}
> -	local png=${file/%bin/png}
> +	local pnm=${file%bin}pnm
> +	local png=${file%bin}png
> 
>  	local format=$(echo $file | sed -e
> 's|.*-\([[:alnum:]]*\)-\([0-9]*x[0-9]*\).*.bin|\1|' | tr '[:lower:]'
> '[:upper:]') local size=$(echo $file   | sed -e
> 's|.*-\([[:alnum:]]*\)-\([0-9]*x[0-9]*\).*.bin|\2|')
diff mbox

Patch

diff --git a/scripts/bin2png.sh b/scripts/bin2png.sh
index 090f31fa992d..6422ee51bc33 100755
--- a/scripts/bin2png.sh
+++ b/scripts/bin2png.sh
@@ -4,8 +4,8 @@  FILE=${1:-.}
 
 convert_image() {
 	local file=$1
-	local pnm=${file/%bin/pnm}
-	local png=${file/%bin/png}
+	local pnm=${file%bin}pnm
+	local png=${file%bin}png
 
 	local format=$(echo $file | sed -e 's|.*-\([[:alnum:]]*\)-\([0-9]*x[0-9]*\).*.bin|\1|' | tr '[:lower:]' '[:upper:]')
 	local size=$(echo $file   | sed -e 's|.*-\([[:alnum:]]*\)-\([0-9]*x[0-9]*\).*.bin|\2|')