[PATCH] Remove "bashism" from contrib/thunderbird-patch-inline/appp.sh

STALE3762d

4 messages, 2 authors, 2016-06-15 · open the first message on its own page

[PATCH] Remove "bashism" from contrib/thunderbird-patch-inline/appp.sh

From: Maxin john <hidden>
Date: 2016-06-15 22:50:54

Remove "bashism" and minor corrections for
contrib/thunderbird-patch-inline/appp.sh

Signed-off-by: Maxin B. John <redacted>
---
diff --git a/contrib/thunderbird-patch-inline/appp.sh
b/contrib/thunderbird-patch-inline/appp.sh
index cc518f3..1d29f4b 100755
--- a/contrib/thunderbird-patch-inline/appp.sh
+++ b/contrib/thunderbird-patch-inline/appp.sh
@@ -1,8 +1,8 @@
-#!/bin/bash
+#!/bin/sh
 # Copyright 2008 Lukas Sandström <luksan@gmail.com>
 #
 # AppendPatch - A script to be used together with ExternalEditor
-# for Mozilla Thunderbird to properly include pathes inline i e-mails.
+# for Mozilla Thunderbird to properly include patches inline in e-mails.

 # ExternalEditor can be downloaded at http://globs.org/articles.php?lng=en&pg=2
@@ -16,6 +16,11 @@ else
        cd > /dev/null
 fi

+#check whether zenity is present
+if ! type zenity >/dev/null 2>&1 ; then
+       exit 1
+fi
+
 PATCH=$(zenity --file-selection)

 if [ "$?" != "0" ] ; then

Re: [PATCH] Remove "bashism" from contrib/thunderbird-patch-inline/appp.sh

From: Ángel González <hidden>
Date: 2016-06-15 22:50:55

Maxin john wrote:
quoted
Remove "bashism" and minor corrections for
contrib/thunderbird-patch-inline/appp.sh

Signed-off-by: Maxin B. John <redacted>
This is wrong.

You are replacing bash with sh:
quoted
-#!/bin/bash
+#!/bin/sh
but the script still uses bash-specific syntax (aka. bashishms):
quoted
+
 PATCH=$(zenity --file-selection)

 if [ "$?" != "0" ] ; then
So with your change the script won't be able to run on systems which
don't have bash as /bin/sh

The standard equivalent of $( ) are `backticks`.

Re: [PATCH] Remove "bashism" from contrib/thunderbird-patch-inline/appp.sh

From: Ángel González <hidden>
Date: 2016-06-15 22:50:55

Maxin john wrote:
Remove "bashism" and minor corrections for
contrib/thunderbird-patch-inline/appp.sh

Signed-off-by: Maxin B. John <redacted>
This is wrong.

You are replacing bash with sh:
-#!/bin/bash
+#!/bin/sh
but the script still uses bash-specific syntax (aka. bashishms):
quoted hunk
+
 PATCH=$(zenity --file-selection)

 if [ "$?" != "0" ] ; then
So with your change the script won't be able to run on systems which
don't have bash as /bin/sh

Re: [PATCH] Remove "bashism" from contrib/thunderbird-patch-inline/appp.sh

From: Maxin john <hidden>
Date: 2016-06-15 22:50:55

Hi,

Thank you very much for the suggestions. However, I have tested this
script in Ubuntu which uses dash as /bin/sh

Eg: the following script runs successfully in Ubuntu 10.10

#!/bin/dash

PATCH=$(zenity --file-selection)

if [ "$?" != "0" ] ; then
 echo "zenity failed"
else
 echo "success"
fi

I haven't confirmed this in other shell implementations. Please let me
know your comments on this.

Best Regards,
Maxin B. John

2011/3/29 Ángel González [off-list ref]:
Maxin john wrote:
quoted
Remove "bashism" and minor corrections for
contrib/thunderbird-patch-inline/appp.sh

Signed-off-by: Maxin B. John <redacted>
This is wrong.

You are replacing bash with sh:
quoted
-#!/bin/bash
+#!/bin/sh
but the script still uses bash-specific syntax (aka. bashishms):
quoted
+
 PATCH=$(zenity --file-selection)

 if [ "$?" != "0" ] ; then
So with your change the script won't be able to run on systems which
don't have bash as /bin/sh

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help