Re: Bash globbing files only?



with Bash one can list directories (excluding dot dirs) like this:

ls [^.]*/

How can I list files instead of directories with Bash? I thought
this
would be trivial but I can't find a solution anywhere.

I don't think that it can be done with bash, but if you don't mind
switching to zsh -- another extended version of the Bourne shell --
it does become trivial:

~% ls *(.) # list only plain files
~% ls *(/) # list only directories
~% ls *(*) # list only executable files

Yes, I am painfully aware of the power of zsh :) But in this case I
need to do my script with bash and it seems that although globbing for
directories is trivial ( */ ) there is no similar pattern to match
files. Oh, well, I guess I'll need to waste some CPU cycles and launch
find everytime I need to know file names in the current directory.

Thanks.





____________________________________________________________________________________
Sucker-punch spam with award-winning protection.
Try the free Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/features_spam.html

--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list



Relevant Pages

  • Re: Bash globbing files only?
    ... > need to do my script with bash and it seems that although globbing for ... Oh, well, I guess I'll need to waste some CPU cycles and launch ...
    (Fedora)
  • Re: shell changed configuration
    ... Davide Bianchi wrote: ... but if i launch "bash" from the prompt, it returns with the old appearence ... it seems that it no longer launches the bash prompt: ...
    (comp.os.linux.setup)
  • Re: Bash globbing files only?
    ... | need to do my script with bash and it seems that although globbing ... Oh, well, I guess I'll need to waste some CPU cycles and ... way to differ between files and links in bash without find but I won't ...
    (Fedora)
  • Re: [SLE] Good Mail Reader that can be launched from xterm???
    ... after you got Super-User priviledges and assuming you use bash: ... And then launch the graphical application you want.. ... >Xlib: No protocol specified ...
    (SuSE)
  • Launching And Detaching
    ... I'm using one simple program to launch some daemons. ... (This is all on Linux, in bash, btw.) ... there a way I can launch a program, then have the first program exit, so ... it's no longer using that bash instance? ...
    (comp.lang.perl.misc)