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

Re: Bash question



On Tue, Jul 01, 2003 at 02:46:58AM -0500, Stephan Sauerburger wrote:

> So how can one have the for loop separate the elements of the list only by
> newlines ("\n"), filling the contents of "file" with the whole line,
> and not separate by spaces, tabs, or other white space?

This has been asked and answered a few times in the past.  There are
several ways to do it.  Here is one:

   #!/bin/sh
   IFS=$'\n'

   for FILE in `ls -1`; do
      echo $FILE
   done
   
-- 
Jamin W. Collins



Reply to: