RMMM wrote:
RMMM wrote:As far as I can tell, the variables $filenames and $filenames1 have thesame values. Yet, they behave differently when used in an argument. Is there some hidden aspect to a bash variable that I'm not seeing?I just figured out the problem. I was running this in a shell with dircolors. Arggg!doing filenames=`ls --color=no mydir`is all I needed to do. Well ... maybe there's some better way of getting the filenames that's immune to any invisible codes.
Guess 1: command ls # avoids aliases, I think? \ls # similar env ls # also similar(note: I belive --color=no is default behavior, probably you have an alias that is adding --color=auto / --color=tty, which is why avoiding the alias should work)
Guess 2:
files="$( for f in mydir/* ; do echo -n "${f#mydir/} " ; done )"
# uses bash glob expansion instead of ls, probably faster to boot
Guess 3:
files="$( cd mydir ; echo * )"
--
Matthew
Please do not quote my e-mail address unobfuscated in message bodies.
--
Time is an illusion. Lunchtime doubly so. -- Ford Prefect (Douglas
Adams' HHGttG)
