On Wed, 02 Nov 2011 07:56:19 -0400, Steven Schveighoffer wrote: > On Tue, 01 Nov 2011 14:23:52 -0400, Graham Fawcett <fawc...@uwindsor.ca> > wrote: > >> On Tue, 01 Nov 2011 07:27:44 -0400, Kagamin wrote: >> >>> Steven Schveighoffer Wrote: >>> >>>> Oh I remember doing that too :) Don't feel bad, everyone does this >>>> at least once. I hate that stupid test builtin, nobody ever uses it >>>> anymore. >>>> >>>> Note, it's not a command line tool, it's a shell builtin, which is >>>> why it overrides anything in your search path. >>>> >>>> I've since adopted the habit of calling test programs "testme" >>>> instead of "test" :) >>> >>> Huh, must port windows console to linux ^_^ >> >> Too much work! Just put >> >> alias test='./test' >> >> in your .profile, and be happy. :) > > That's a cool trick :) > > However, one issue, if you do happen to run any shell scripts where some > a**hole insisted on using test instead of the [] form, this will cause > problems. There must be some way to check for an interactive shell...
I can't speak for all shells, but bash and zsh don't expand aliases when you run a script. From the bash manual: Aliases are not expanded when the shell is not interactive, unless the expand_aliases shell option is set using shopt (see the description of shopt under SHELL BUILTIN COMMANDS below). Cheers, Graham