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

Re: bash: for to, reading escaped spaces in filenames



Jeff Schaller wrote:

David selby <debian@pusspaws.net> wrote:
I need to scan a directory for the file names contained in it.

However some of the file names are in the form of
342345\ remind\ for\ apt-get\ update

ie they have escaped spaces in the name.

Without resorting to complex string manipulation & cutting, is there a
neat way to do this ?

I missed the start of this thread (just joined the list), but does
this work for you?

ls -1 *pattern* | while read file; do echo $file; done

-jeff
Many thanks for your input, finally used a globbing solution by steve,

for var in ..../*; do
....
done

Though I will try your suggestion, I had not thought of this either !

Dave




Reply to: