zsh-users
 help / Atom feed
* Re: is there a way to use *.{txt,zip,tbz,dmg} if one or more might be 
@ 2019-07-07 23:39 jdh
  0 siblings, 0 replies; 2+ messages in thread
From: jdh @ 2019-07-07 23:39 UTC (permalink / raw)
  To: zsh-users


There shold be two ways to do that;

      1.)  Using extended flags

      	   	 setopt nullglob        # this will last throughout your session


or     2.) Add the 'N' flag like this:

      	         ls *.{txt,pdf,ods,odg,jpg}(N)   # this is on a singular basis


	You may need to prefix the 'N' like this (#QN) but I didn't have to.

       	         ls *.{txt,pdf,ods,odg,jpg}(#qN)


TJ Luoma <luomat@gmail.com> wrote:

> This seems like one of those things that I might have not learned that
> everyone else knows, so I thought I'd ask.
> 
> I can use this:
> 
>         mv -vn *.{txt,zip,tbz,dmg} ~/dir/
> 
> to move all files that end with zip/txt/tbz/dmg to ~/dir/
> 
> BUT it will fail if it does not find at least one file with each of
> those extensions.
> 
> Is there a way to do basically the same thing, but tell `mv` "if is at
> least one file with any of these extensions, then move to ~/dir/" ?
> 
> I suppose I could use `find` with various `-o` flags, but I was
> wondering if there was an easier way.
> 
> Thanks!
> 
> Tj
> 
> --
> TJ Luoma
> TJ @ MacStories
> Personal Website: luo.ma (aka RhymesWithDiploma.com)
> Twitter: @tjluoma

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: is there a way to use *.{txt,zip,tbz,dmg} if one or more might be
       [not found] <20190707163948.6202__37372.3986953095$1562542863$gmane$org@Huxley>
@ 2019-07-21 19:11 ` Stephane Chazelas
  0 siblings, 0 replies; 2+ messages in thread
From: Stephane Chazelas @ 2019-07-21 19:11 UTC (permalink / raw)
  To: zsh-users

2019-07-07 16:39:48 -0700, jdh:
> 
> There should be two ways to do that;
> 
>       1.)  Using extended flags
> 
>       	   	 setopt nullglob        # this will last throughout your session
[...]

cshnullglob would be less problematic than nullglob here.

Note that that very question was asked (and answered) on
unix.stackexchange.com at
https://unix.stackexchange.com/questions/298548/matching-files-using-curly-brace-expansion-in-zsh

-- 
Stephane

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-07 23:39 is there a way to use *.{txt,zip,tbz,dmg} if one or more might be jdh
     [not found] <20190707163948.6202__37372.3986953095$1562542863$gmane$org@Huxley>
2019-07-21 19:11 ` Stephane Chazelas

zsh-users

Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-users

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.users


AGPL code for this site: git clone https://public-inbox.org/ public-inbox