It is important to realize that the child process cannot possibly affect the parent's environment. When you run the command from the executable file, a second copy of bash is forked, it has its environment changed and then dies leaving no trace. The builtins (dot and source for example) are executed in the context of the current process, without forking a child, and the environment modifications stay put.
To make a simple one word command, you may wrap it in the function, and have that function in .bashrc, or some other autosourced file of your preference.
Griff0527 commented: excelent testing code. I spotted the error in my c2f code almost immediately by using this +1
gerard4143 commented: Thanks for the clear explanation +3
nezachem 616 Practically a Posting Shark
nezachem 616 Practically a Posting Shark
nezachem 616 Practically a Posting Shark
nezachem 616 Practically a Posting Shark
nezachem 616 Practically a Posting Shark
nezachem 616 Practically a Posting Shark
nezachem 616 Practically a Posting Shark
nezachem 616 Practically a Posting Shark
Ancient Dragon commented: Glad to know that. Not the first time I've been wrong about something :) +28
Salem commented: Very nice - +20
jephthah commented: well-put. i can live with that :) +7
nezachem 616 Practically a Posting Shark
BestJewSinceJC commented: Thanks again +5