I ran into an oddity in alias expansion.  I don't know if it
is a bug, or some feature I'm unfamiliar with:

Two aliases:
   alias ls='ls -CFG --show-control-chars --color=tty '
   alias dir='ls'

If I type "ls dir" (created a test dir called dir), I
get:
   "ls dir"
I get:
   ls: ls: No such file or directory.

This was "unexpected". Tracing showed:

/tmp> ls foo
+ ls -CFG --show-control-chars --color=tty foo
ls: foo: No such file or directory
---the above is "normal"---but below:
/tmp> ls dir
+ ls -CFG --show-control-chars --color=tty ls -CFG --show-control-chars --color=tty
ls: ls: No such file or directory
----  Where the filename should have been I see dir treated
as another alias to be expanded. Huh?
I traced the cause to the ls alias -- the "space" at the
end of the alias is causing the behavior: with space,
it expands "dir" as another alias.  Without the space at
the end, it works as I would have normally expected.

Is this a bug, or some feature I'm unfamiliar with?

Thanks,
-linda




_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to