help-bash
[Top][All Lists]
Advanced

[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: Evan Gates
Subject: Re: [Help-bash] Glob star pattern does not match files beginning with a period
Date: Mon, 13 Jul 2015 14:55:19 -0700

On Mon, Jul 13, 2015 at 2:50 PM, Michael Convey <address@hidden> wrote:
>
> 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.

Almost. You want .[!.]* and ..?* so you don't miss files like ..foobar

> Your original command will work if you set the dotglob option via "shopt
> -s dotglob".

But this is probably the better option when using bash.

-emg



reply via email to

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