[lug] Bizarre behaviour? XTerm runs test program?
Alan Robertson
alanr at unix.sh
Thu Jul 7 16:32:37 MDT 2005
rm at fabula.de wrote:
> On Tue, Jul 05, 2005 at 05:45:47PM -0500, Hugh Brown wrote:
>>If you changed your path, it may have picked up the little program named
>>test.
>>
>>A lot of shell scripts use test or [ ] to check various parameters.
>>This bit me once a long time ago, I was writing a little test program
>>and named it test and couldn't figure out why I couldn't get it to run
>>like I thought it should.
>
> This is a classic Unix beginning programmers gotcha ;-) Never name
> programs 'test' (or 'ls' or 'cd' ...).
ls is no big problem. But built-in things like test or cd are another
matter. The setting of $PATH doesn't affect them :-) -- you have to
invoke them as ./test or ./cd. IIRC, that works :-)
--
Alan Robertson <alanr at unix.sh>
"Openness is the foundation and preservative of friendship... Let me
claim from you at all times your undisguised opinions." - William
Wilberforce
More information about the LUG
mailing list