help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] How to safely work on files/dirs with .


From: Greg Wooledge
Subject: Re: [Help-bash] How to safely work on files/dirs with .
Date: Mon, 14 Mar 2016 10:33:43 -0400
User-agent: Mutt/1.4.2.3i

On Mon, Mar 14, 2016 at 02:20:15PM +0000, Stephane Chazelas wrote:
> 2016-03-14 08:40:54 -0400, Greg Wooledge:
> > For completeness, and to get things back on topic for help-bash,
> > bash includes a shopt named "dotglob" which makes * match files
> > beginning with dot.
> 
> Note that it doesn't prevent the expansion of . and .. in a .*
> glob (which was the point being discussed here):
> 
> $ bash -O dotglob -c 'echo .*'
> . .. .a

So, don't do that.

imadev:~/tmp$ rm *
imadev:~/tmp$ touch .foo bar
imadev:~/tmp$ bash -O dotglob -c 'echo *'
bar .foo

Simple!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]