Bob Proulx wrote: >>> Why are you using the -p option? >>> >>> >> To prevent possible side effects from inheriting shell functions from >> current environment, SHELLOPTS, any settings in $ENV, etc. Why would I >> want to have all that crap in my environment if my goal is to test >> exactly what I have coded in my script? >> > #!/bin/bash -p > > > If you have crap in your environment then you should fix that problem > first. It led me to believe that you were trying to run a setuid > script or something. > By "all that crap", I meant "All that stuff which is unnecessary for the task at hand." Everything in my environment is useful, but that doesn't mean I want it influencing shell scripts. I write a lot of cross-platform shell scripts for use by other people. It does not do to test these with my own personal customizations. When I am testing base Bash behavior, like in this case, I want to test with a basic Bash environment, not a customized one where personal settings may mask a problem with default Bash behaior, or even be the cause of the problem at hand.
If Bash had a setting to not inherit customizations without modifying uid behavior, I wouldn't need to use misleading switches.