From patchwork Thu May 21 12:50:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitri John Ledkov X-Patchwork-Id: 6454761 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C75C2C0432 for ; Thu, 21 May 2015 12:51:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1C01720450 for ; Thu, 21 May 2015 12:51:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EB74420435 for ; Thu, 21 May 2015 12:51:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755273AbbEUMu7 (ORCPT ); Thu, 21 May 2015 08:50:59 -0400 Received: from mga01.intel.com ([192.55.52.88]:17778 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754448AbbEUMu7 (ORCPT ); Thu, 21 May 2015 08:50:59 -0400 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP; 21 May 2015 05:50:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,468,1427785200"; d="scan'208";a="574829128" Received: from lramir2-mobl4.ger.corp.intel.com (HELO localhost) ([10.252.6.49]) by orsmga003.jf.intel.com with ESMTP; 21 May 2015 05:50:57 -0700 From: Dimitri John Ledkov To: linux-btrfs@vger.kernel.org Subject: [PATCH] fsck.btrfs: Fix bashism and bad getopts processing Date: Thu, 21 May 2015 13:50:55 +0100 Message-Id: <1432212655-6238-1-git-send-email-dimitri.j.ledkov@intel.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <20150521115651.GP23255@twin.jikos.cz> References: <20150521115651.GP23255@twin.jikos.cz> Organization: Intel Corporation (UK) Ltd. - Co. Reg. #1134945 - Pipers Way, Swindon SN3 1RJ Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP First fix == bashism, as that is not accepted by e.g. Debian/Ubuntu dash. Secondly shift OPTIND, such that last parameter is checked to exist. Signed-off-by: Dimitri John Ledkov --- fsck.btrfs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fsck.btrfs b/fsck.btrfs index f056a7f..20b070a 100755 --- a/fsck.btrfs +++ b/fsck.btrfs @@ -26,12 +26,13 @@ do a|A|p|y) AUTO=true;; esac done +shift $(($OPTIND -1)) eval DEV=\${$#} if [ ! -e $DEV ]; then echo "$0: $DEV does not exist" exit 8 fi -if [ "$AUTO" == "false" ]; then +if ! $AUTO; then echo "If you wish to check the consistency of a BTRFS filesystem or" echo "repair a damaged filesystem, see btrfs(8) subcommand 'check'." fi