All of lore.kernel.org
 help / color / mirror / Atom feed
From: Victor Engmark <victor.engmark@terreactive.ch>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Ángel González" <ingenit@zoho.com>, git@vger.kernel.org
Subject: Re: [PATCH] Remove "bashism" from contrib/thunderbird-patch-inline/appp.sh
Date: Tue, 29 Mar 2011 16:03:26 +0200	[thread overview]
Message-ID: <4D91E6AE.9040208@terreactive.ch> (raw)
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:

>>>  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).

> 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

  parent reply	other threads:[~2011-03-29 14:03 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
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 [this message]
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=4D91E6AE.9040208@terreactive.ch \
    --to=victor.engmark@terreactive.ch \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=ingenit@zoho.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.