Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Dec 2017 01:19:48 +0000
From:      RW <rwmaillists@googlemail.com>
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>

next in thread | previous in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20171207011948.65dbfa00>