[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Glob star pattern does not match files beginning with a
From: |
Michael Convey |
Subject: |
Re: [Help-bash] Glob star pattern does not match files beginning with a period |
Date: |
Mon, 13 Jul 2015 14:50:08 -0700 |
On Mon, Jul 13, 2015 at 11:57 AM, David Niklas <address@hidden> wrote:
> ls *
> Documents
> tmp
> rtorrent-session
>
> I'm using bash version 4.3.39.
> I want * to match _everything_ but "." and ".." .
>
> Thanks, David
>
>
According to the bash reference manual:
When a pattern is used for filename expansion, the character ‘.’ at the
start of a filename or immediately following a slash must be matched
explicitly, unless the shell optiondotglob is set.
Source: http://www.gnu.org/software/bash/manual/bash.html#Filename-Expansion
Therefore, you need two arguments to the ls command to accomplish what you
are trying to do, as follows:
ls -d * .[!.]?*
The first argument * matches all regular files. The second argument .[!.]?*
matches all hidden files by expanding into every filename that begins with
a period, does not include a second period, contains at least one
additional character, and may be followed by any other characters.
Your original command will work if you set the dotglob option via "shopt
-s dotglob".
- [Help-bash] Glob star pattern does not match files beginning with a period, David Niklas, 2015/07/13
- Re: [Help-bash] Glob star pattern does not match files beginning with a period,
Michael Convey <=
- Re: [Help-bash] Glob star pattern does not match files beginning with a period, Evan Gates, 2015/07/13
- Re: [Help-bash] Glob star pattern does not match files beginning with a period, Michael Convey, 2015/07/13
- Re: [Help-bash] Glob star pattern does not match files beginning with a period, Michael Convey, 2015/07/15
- Re: [Help-bash] Glob star pattern does not match files beginning with a period, Greg Wooledge, 2015/07/15
- Re: [Help-bash] Glob star pattern does not match files beginning with a period, Eric Blake, 2015/07/15
- Re: [Help-bash] Glob star pattern does not match files beginning with a period, Michael Convey, 2015/07/15
- Re: [Help-bash] Glob star pattern does not match files beginning with a period, Peter West, 2015/07/16
- Re: [Help-bash] Glob star pattern does not match files beginning with a period, Greg Wooledge, 2015/07/16
- Re: [Help-bash] Glob star pattern does not match files beginning with a period, Eric Blake, 2015/07/16
- Re: [Help-bash] Glob star pattern does not match files beginning with a period, Michael Convey, 2015/07/16