Re: Bash globbing files only?

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

 



Yep, that would work, but I guess my question was a bit poorly
formulated. I am writing a bash script that has:

dirs=[^.]*/

and I'd like to have "files=..." without using find or other external
commands if at all possible.

Thanks.


Actually that last one wasn't ideal.  A better solution would be
ls -lAR / | grep "^-"
This would give you files, not symbolic links, not directories, not
block devices, not character devices.

I can't find any way to do it with ls alone.

Of course the best way is with the find command, being

find / -type f

which will not only give you the file names, but with their complete
path.  If you want the files listed in long format, then use

find / -type f -ls

By the way the syntax you have to list directories does not work for
me.  It yields the same results as if I did ls *, which lists all
files in the current directory, and files in directories contained in
the current directory (in lieu of listing the directory name).

Any reason why you'd rather use ls instead of find?

Thanks,

Jacques


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux