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
ÁGÁngel González <ingenit@zoho.com>
Date
Mar 29, 2011, 22:48 UTC
Message-ID
<4D9261AE.5070103@zoho.com>
In-Reply-To
<7vei5qtnc5.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
Show 13 quoted lines
> Á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
Show 7 quoted lines
>>>  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.
Show 7 quoted lines
> 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.

Previous: Junio C HamanoNext: Maxin john
Message 5 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.