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


So, as expected then, yes?
Yes, as expected.  But not what I understood the OP was trying to do.
Unless I'm mistaken, that syntax (ls [^.]*/) was used to assign the
directory names in the current working directory to a variable.
However that is not the output of that command. The output is the
directories and their contents.  Hence where much of my confusion

Does it make sense now?
Yes, it finally clicked this morning around 5:00 am when I was
driving.  I now understand the reason for the */ part of the syntax.

Ultimately the OP's wishes would be best/most accurately met using the
find command from what I can gather.

dirs=`find -maxdepth 1 -type d \! -regex "^\.$"`
(the \! -regex "^.$" to eliminate the . directory)
files=`find -maxdepth 1 -type f`

Or to remove the path name (./) to have only the file names (or
directory names), I would use:
files=`find -maxdepth 1 -type f -printf "%f "`
resulting in a space delimited output.

Jacques B.

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