From owner-freebsd-questions@freebsd.org Thu Dec 7 01:19:54 2017 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78B04E93DC0 for ; Thu, 7 Dec 2017 01:19:54 +0000 (UTC) (envelope-from rwmaillists@googlemail.com) Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1031D6CDCF for ; Thu, 7 Dec 2017 01:19:54 +0000 (UTC) (envelope-from rwmaillists@googlemail.com) Received: by mail-wm0-x244.google.com with SMTP id f140so10146781wmd.2 for ; Wed, 06 Dec 2017 17:19:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CZFBoIusRJvPR1Zg7dZypmmMGe5HnpIDu6x2+gjl+oo=; b=IzuyYm7J/w3DlD7+/n3uddmf8+5MHkFa57XPnEmgN07N/pUq/6bHLB2SXZRVIXx98D BTStfQ4QkkYNWdClMDsH5ilJ/36wmvPb6S+eCio8My86Djj55Ceyt5d2cUnmuusMfr2z aoS5UMnd6lojc6IFzWppNJHhS/1YMmrcU+2tMNo09UNnI+a5Lz/jjvvxniF44RB4Qqa0 1JF4JMyKDnuPcW2S5wRbEK07Tu/IM1S0CFfP7NLEtLTnT7FXG0WBdo1im702qXqRgVdg gLNOqDpHCsG1WdGBQzHg6gJ5gOCQ2bRLS6DubukM39iGgwGKmo2evIHjv9BvVq87/hqa rrNw== X-Gm-Message-State: AJaThX5+2KiW/QXNsxEAiwyft20SivUyfQNn2j4u6TwrCeDrq0mwIrMg LEjqv3LtVrDrkNn6WaCyZQPaTQ== X-Google-Smtp-Source: AGs4zMYrnfgtt3L0mIlndqmFFd9DzxM/qj7/MJJBNj2nQQgcxv8EVVUM+JSYOixBTSQQa2bs7IloBQ== X-Received: by 10.80.192.85 with SMTP id u21mr41586547edd.37.1512609592083; Wed, 06 Dec 2017 17:19:52 -0800 (PST) Received: from gumby.homeunix.com ([81.17.24.158]) by smtp.gmail.com with ESMTPSA id i2sm1846278edb.31.2017.12.06.17.19.50 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Dec 2017 17:19:51 -0800 (PST) Date: Thu, 7 Dec 2017 01:19:48 +0000 From: RW To: freebsd-questions@freebsd.org Subject: Re: grep problem Message-ID: <20171207011948.65dbfa00@gumby.homeunix.com> In-Reply-To: <20171207005542.43a7f55f@gumby.homeunix.com> References: <20171207005542.43a7f55f@gumby.homeunix.com> X-Mailer: Claws Mail 3.15.1 (GTK+ 2.24.31; amd64-portbld-freebsd11.1) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Dec 2017 01:19:54 -0000 On Thu, 7 Dec 2017 00:55:42 +0000 RW wrote: > Can anyone explain why '-' needs escaping in the following. What > special meaning does it have outside of []? > > $ echo 'a-b' | grep 'a-b' > a-b > > $ echo 'a-b' | grep '-b' > Usage: grep [OPTION]... PATTERN [FILE]... Never mind, the shell handles the quotes, so grep sees -b as an option rather than a pattern.