Re: [PATCH] Fix bashism in fsck.btrfs for debian/ubuntu dash.

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

 



On Sat, May 16, 2015 at 10:27:11AM +0200, Florian Gamböck wrote:
> Am 15.05.2015 um 22:43 schrieb Omar Sandoval:
> >I'm going to completely bikeshed here, but Yoda conditions are already
> >ugly in C, and completely pointless in Bash, where you can't ever
> >accidentally reassign a variable in a condition. Either way, I think:
> >
> >if [ ! $AUTO ]; then
> >
> >would be clearer anyways.
> 
> Ah, I'm sorry to disagree with you, but your code snippet would only work if
> $AUTO is *empty*, and I think, to be totally correct you'd have to use the
> -n or -z test.
> 
> To sum it up now, you'd have to replace "false" with an empty string in the
> beginning of the file and the zero-test in the end. So something like the
> following:
> 
> AUTO=
> # ...
> if [ -z "$AUTO" ]; then
> 

Whoops, you're totally right, that was a typo. I meant

if ! $AUTO; then

-- 
Omar
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux