Day wrote: > Yes, Bob. This problem came out because I set an alias for `ls' in > my .bashrc file > alias ls='ls -F --color' > > So when I run the script what goes in to the [] test is `ls -F > --color -A ./dir' in fact. Thus issued the problem. Thanks for your > msg.
Hmm... But aliases are not used in scripts. Scripts shouldn't be reading your .bashrc file and therefore shouldn't be affected by aliases there. If in your environment scripts are reading you .bashrc file then you should fix it because there will almost certainly be other similar problems such as this. Are you setting ENV or BASH_ENV to your .bashrc environment file? That would cause scripts to source it. Although BASH_ENV and ENV have special uses they shouldn't be set in the normal course of events for bash. (For ksh use setting ENV is typical.) If that is the problem I think you should unset those variables. Or perhaps you are using the alias in your .bashrc file itself? Because aliases would only be expanded within the particular shell that source the .bashrc file. So if in the .bashrc script itself you were subsequently using the ls command after the alias then that would also be a problem. I usually put aliases at the very bottom of the file for this reason. In any case, you can avoid alias expansion by quoting the command. 'ls' "ls" \ls command ls All of those would avoid the alias expansion. Plus using --color=auto would also avoid the problem. Bob _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils