ls mystery

Michael Abbott michael at araneidae.co.uk
Wed Feb 18 17:15:31 GMT 2004


> That was the behaviour I was seeing but more worrying was this
> behaviour:
>
> $ export CLICOLOR=true
> $ ls x
> $ /bin/ls x
> y
>
> ie. the result of running ls was dependent on whether you called it
> with its full path!

Well, one key difference as I recall from your original post is that your
ls is actually an alias, so of course when you type /bin/ls you're
bypassing the alias.  If you unset the alias do you get the same behaviour
(taking any flags into account)?  Do say what flags you're setting with
the 'ls' alias.

It would be useful to test this in a bare shell (with no environment
variables set) but I don't know how to set that up.

One explanation for what you see could be: setting CLICOLOR doesn't
necessarily force colour output (for example, `(unset TERM; ls x)` lists
the file y even if CLICOLOR is set), but perhaps one of your default ls
alias flags is forcing state to be inspected.  So in my environment I get

	$ (unset TERM; ls x)
	y
	$ (unset TERM; ls -F x)
	$

> Pete French couldn't replicate that behaviour, I don't know if you or
> Ben can. I don't want to be alone in this because it worries me...

Nor can I, I'm afraid.  I suspect complex environment interaction, though,
along with the odd BSD specific feature we've already noted.




More information about the Ukfreebsd mailing list