git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maxin john <maxin@maxinbjohn.info>
To: Junio C Hamano <gitster@pobox.com>,
	Git Mailing List <git@vger.kernel.org>
Cc: "Ángel González" <ingenit@zoho.com>,
	"Victor Engmark" <victor.engmark@terreactive.ch>
Subject: Re: [PATCH] Remove "bashism" from contrib/thunderbird-patch-inline/appp.sh
Date: Wed, 30 Mar 2011 09:52:23 +0100	[thread overview]
Message-ID: <AANLkTim+0gxGKZT=vfmX7v0QZrApjRwAzW3PiLePL-iQ@mail.gmail.com> (raw)
In-Reply-To: <4D9261AE.5070103@zoho.com>

Hi,

> Junio C Hamano wrote:
..
>> 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}"`

  reply	other threads:[~2011-03-30  8:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-27 14:37 [PATCH] Remove "bashism" from contrib/thunderbird-patch-inline/appp.sh Maxin john
2011-03-28 21:55 ` Ángel González
2011-03-29  6:54   ` Maxin john
2011-03-29  7:09   ` Junio C Hamano
2011-03-29 22:48     ` Ángel González
2011-03-30  8:52       ` Maxin john [this message]
2011-03-30 17:57         ` Junio C Hamano
2011-03-30 18:51           ` Maxin john
2011-03-31 21:56         ` Junio C Hamano
     [not found]   ` <8721039.4955.1301382568626.JavaMail.trustmail@mail1.terreactive.ch>
2011-03-29 14:03     ` Victor Engmark
2011-03-29  0:16 ` Ángel González
2011-03-29  1:01 ` Junio C Hamano
2011-03-29  6:47   ` Maxin john

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTim+0gxGKZT=vfmX7v0QZrApjRwAzW3PiLePL-iQ@mail.gmail.com' \
    --to=maxin@maxinbjohn.info \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=ingenit@zoho.com \
    --cc=victor.engmark@terreactive.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).