BASH scripting question

From: NS (lesborock_at_NOSPAM.yahoo.com.au)
Date: 10/07/03


Date: Tue, 07 Oct 2003 14:33:39 +1000

I have a very simple task that eludes me.
I have been in the process of administrating a huge amount of data on a
pre-existing file server. The problem is that a lot of the directories and
files have been copied from various sources and as a result have
non-sequitor file names. eg. containing one or more spaces and ampersands.
This obviously causes some problems.

Stop me here if there is an easier way.

I need to compile a list of all these files and especially directories.

So in a shell script I do:

directories=`find . -type d -print`

The problem is that the escape characters for the spaces etc. get
interpereted as newlines, so that when I try to reference the names from
within the variable it breaks them.

I have tried (and other variations):

echo $directories | sed -e 's/\\//g' > result
directories =`cat result`

but still no joy.

I know it's simple but I can't seem to work it out.

Thanks in advance.



Relevant Pages

  • Re: BASH scripting question
    ... > I have been in the process of administrating a huge amount of data on a ... > pre-existing file server. ... Normal solution -- ...
    (alt.os.linux)
  • Re: BASH scripting question
    ... > I have a very simple task that eludes me. ... > I have been in the process of administrating a huge amount of data on a ... > So in a shell script I do: ...
    (alt.os.linux)
  • Re: BASH scripting question
    ... >> I have a very simple task that eludes me. ... >> I have been in the process of administrating a huge amount of data on a ...
    (alt.os.linux)
  • Re: Chemical potential of photons
    ... i have been reading about the chemical potential for quite a few days ... but the concept still eludes me. ... The chemical potential refers to the amount of energy required to change the number, either by removing a particle or creating one. ...
    (sci.physics)