Re: [PATCH] Remove "bashism" from contrib/thunderbird-patch-inline/appp.sh

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/29/2011 09:09 AM, Junio C Hamano wrote:
> Ãngel GonzÃlez <ingenit@xxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]