git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ángel González" <ingenit@zoho.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] Remove "bashism" from contrib/thunderbird-patch-inline/appp.sh
Date: Wed, 30 Mar 2011 00:48:14 +0200	[thread overview]
Message-ID: <4D9261AE.5070103@zoho.com> (raw)
In-Reply-To: <7vei5qtnc5.fsf@alter.siamese.dyndns.org>

Junio C Hamano wrote:
> Ángel González <ingenit@zoho.com> writes:
> 
>> This is wrong.
> 
> Not really.
> 
>> You are replacing bash with sh:
>>> -#!/bin/bash
>>> +#!/bin/sh
>>
>> but the script still uses bash-specific syntax (aka. bashishms):
> 
> Do you mean some of the parts you quoted are bashism?

I was pointing to the $( ) as a bashishm

>>>  PATCH=$(zenity --file-selection)
> 
> 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).

I have to agree with you. $() is a much saner syntax. Still, the goal
was portability.
Reading your message, and considering the Solaris note, it might have
been fine as it was. I have also checked the "Shell Command Language"
section of IEEE Std 1003.1 and it does require $() use.

Albeit being a single line I would still change it, it is now a much
weaker position. Thanks for your insight.

  reply	other threads:[~2011-03-29 22:44 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 [this message]
2011-03-30  8:52       ` Maxin john
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=4D9261AE.5070103@zoho.com \
    --to=ingenit@zoho.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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).