Use quotes.. these things ---> " "
:)
I didn't get to read your whole message, but quotes protect text from
default parameterization rules of the shell, etc.
Therefore: cat "Filename with spaces.txt"
will.. well.. you get the idea
A common script I do do is like:
for f in *.c
do
echo -e "$f"
fi
or something like that.. not exactly what I do all the time but it does
demo the use of the quotes ;)
If all of what I just typed has nothing to do with your post, then please
excuse me.. I just got home from work and I'm tired. Need a nap :)
On Sat, 25 Nov 2000, Mark Ivey wrote:
> Ok, I have some directories with spaces in the names:
> $ ls -1
> Astral Projection/
> Divinorum/
> Fusion 19/
> GoaArchive/
> Starfire Records/
>
> And I'm trying to write a bash script to modify files in each directory.
> The spaces are giving me problems. Here are two short bash scripts:
> LIST=*; echo $LIST;
> LIST=$(\ls); echo $LIST;
>
> Now, they both _seem_ to give the same output. It looks like this:
> Astral Projection Divinorum Fusion 19 GoaArchive Starfire Records
>
> Here are two more scripts, similar to the first 2:
> LIST=*; for NAME in $LIST; do echo "-->" $NAME; done
> LIST=$(\ls); for NAME in $LIST; do echo "-->" $NAME; done
>
> They give different output. The first one gives:
> --> Astral Projection
> --> Divinorum
> --> Fusion 19
> --> GoaArchive
> --> Starfire Records
>
> and the second one gives:
> --> Astral
> --> Projection
> --> Divinorum
> --> Fusion
> --> 19
> --> GoaArchive
> --> Starfire
> --> Records
>
>
> So, how do I get the second one to work like the first one? I've tried
> putting quotes around the filenames (\ls -Q), but it doesn't work. It
> still splits the names at the spaces. I will have other files alongside
> the directories later, so I can't just use the * version. Also, I know I
> could use the -exec flag on the find command, but I am having this problem
> with a few other for loops that I can't use find on, so I would really
> like to know how to get the for command to work. Thanks....
>
>
> -Mark Ivey-
>
>
>
> _______________________________________________
> Redhat-list mailing list
> [EMAIL PROTECTED]
> https://listman.redhat.com/mailman/listinfo/redhat-list
>
--
-Statux
_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list