I have sourced a script in bash source somescript.sh. Is it possible to undo this without restarting the terminal? Alternatively, is there a way to “reset” the shell to the settings it gets upon login without restarting?
EDIT: As suggested in one of the answers, my script sets some environment variables. Is there a way to reset to the default login environment?
The best option seems to be to use
unsetto unset the environment variables that sourcing produces. AddingOLD_PATH=$PATH; export OLD_PATHto the.bashrcprofile saves a backup of the login path in case one needs to revert the$PATH.