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
VEVictor Engmark <victor.engmark@terreactive.ch>
Date
Mar 29, 2011, 14:03 UTC
Message-ID
<4D91E6AE.9040208@terreactive.ch>
In-Reply-To
<8721039.4955.1301382568626.JavaMail.trustmail@mail1.terreactive.ch>
On 03/29/2011 09:09 AM, Junio C Hamano wrote:
> Ángel González <ingenit@zoho.com> writes:
Show 8 quoted lines
>>>  if [ "$?" != "0" ] ; then
> 
> While I personally do not like this style (I am old fashioned) and would
> probably write:
> 
> 	if test $? != 0
>         then
>         	...

Nitpicking I suppose, but since `$?` is always an integer we should use `-ne` (positive/negative integers) instead of `!=` (string comparison).

Show 8 quoted lines
> or make it even more readable by writing it together with the previous
> statement, i.e.
> 
> 	PATCH=$(zenity --file-selection) ||
>         ...
> 
> myself, it is definitely not bash-ism to use [] for conditionals.  Some
> people seem to find it more readable than traditional "test" (not me).
Alternatively:

if ! PATCH=$(zenity --file-selection) then ...

Yep, that works in dash - Both variable assignment and exit code checking.
-- 
Victor Engmark
Previous: Maxin john
Message 13 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.