git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
MJMaxin john <maxin@maxinbjohn.info>
Date
Mar 30, 2011, 08:52 UTC
Message-ID
<AANLkTim+0gxGKZT=vfmX7v0QZrApjRwAzW3PiLePL-iQ@mail.gmail.com>
In-Reply-To
<4D9261AE.5070103@zoho.com>
Hi,
> Junio C Hamano wrote:
..
Show 12 quoted lines
>> Even though ancient shells I grew up with did not have $(), it is a way
>> backticks should have been written by Bourne from day one.  Historically,
>> handling nesting and interraction between double-quotes and backticks
>> correctly was a nightmare to get right, and different implementations of
>> shells got them always wrong.  If you use $(), the headaches go away.
>> These days, we don't know of any POSIX shell that is widely used and does
>> not understand $().  As such, the above construct is perfectly safe and
>> even preferred over ``.  Welcome to the 21st century ;-)
>>
>> The only major platform that didn't have a reasonable shell was Solaris,
>> but we already have written its /bin/sh off as broken and unusable, and
>> suggest people to use xpg4 or xpg6 shell (see the Makefile).

Thank you very much for sharing this information. It was really really informative. Thanks to Ángel González and Victor Engmark for sharing their views.

Considering all the suggestions, I think, it is "not possible to satisfy everyone" :) So, I have modified the patch by incorporating most of the nice suggestions.

Please let me know your comments.
Signed-off-by: Maxin B. John <maxin@maxinbjohn.info>
---
diff --git a/contrib/thunderbird-patch-inline/appp.sh
b/contrib/thunderbird-patch-inline/appp.sh
index cc518f3..20dac9f 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,13 +16,12 @@ else
        cd > /dev/null
 fi

-PATCH=$(zenity --file-selection)
-
-if [ "$?" != "0" ] ; then
-       #zenity --error --text "No patchfile given."
-       exit 1
+#check whether zenity is present
+if ! type zenity >/dev/null 2>&1 ; then
+       exit 1
 fi

+PATCH=$(zenity --file-selection) || exit 1
 cd - > /dev/null

 SUBJECT=`sed -n -e '/^Subject: /p' "${PATCH}"`
Previous: Ángel GonzálezNext: Junio C Hamano
Message 6 of 13 in “Remove "bashism" from contrib/thunderbird-patch-inline/appp.sh”
  1. Remove "bashism" from contrib/thunderbird-patch-inline/appp.shMaxin john, Mar 27, 2011
  2. Ángel GonzálezMar 28, 2011
  3. Maxin johnMar 29, 2011
  4. Junio C HamanoMar 29, 2011
  5. Ángel GonzálezMar 29, 2011
  6. Maxin johnMar 30, 2011
  7. Junio C HamanoMar 30, 2011
  8. Maxin johnMar 30, 2011
  9. Junio C HamanoMar 31, 2011
  10. Ángel GonzálezMar 29, 2011
  11. Junio C HamanoMar 29, 2011
  12. Maxin johnMar 29, 2011
  13. Victor EngmarkMar 29, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.