Web lists-archives.com

Re: User rw Permissions on New Hard Drive

On Fri, Mar 01, 2019 at 10:52:00AM -0600, David Wright wrote:
> On Fri 01 Mar 2019 at 01:30:47 (-0500), Cindy-Sue Causey wrote:
> > That's what I'd been thinking, too. Because of your question, I just
> > tried a search for...
> > 
> > "defaults,rw" /etc/fstab
> You've really limited what can be found with that string.
> For example, you won't find rw,defaults. But the shell
> makes a more productive search string look like toothpick-hell:
> $ grep '\(rw\)\|\(defaults\)' /etc/fstab
> will match lines with either word.

*shudder*  You don't need ANY of those parentheses, let alone escaped
parentheses.  And you're relying on a GNUism to make the | work instead
of just calling grep -E or egrep like you're supposed to.

grep -E 'rw|defaults' /etc/fstab

If you wanted to match lines that have BOTH strings, then try
<https://mywiki.wooledge.org/BashFAQ/079> instead.