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

Re: Maybe offtopic: Dealing with filenames with blanks in a script



I think this should work:

for i in `ls *`; do cat "$i"; done

diego escribió:
Hello, I know this is nearly offtopic, but need some help on a simple
one line script as didn't find a simple solution through Google.

I'm trying to manage files that have one or more blanks in their names
(I'm not responsible for them being in such *nice* format...). Let's say
I have the files:

test 1
test 2
test 3

I want a script to do some processing on them, let's simplify with a
simple cat:

for i in `ls *`; do cat $i; done


but this will fail as it consider the blank as a separator for next
filename.

Thanx in advance.




--
-- In TUX I trust --
kronoss:				
Linux Registered User: #333765		
Web Page: http://www.kronoss.org	
Location: Teruel			

Linux agatha 2.6.3 #1 Sat Feb 28 15:12:59 CET 2004 i686 GNU/Linux



Reply to: