Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

This issue has been bugging me for a while, and although I've taught I've found my answer through EnvWatcher, unfortunately it only works on Bash. And I use zsh.

I would like to replicate the things env-watcher does, to a lesser degree maybe, but I need to know if there is a command by which I could reset a shell to it's clean startup stage.

As for example, I'd like to have the following workflow.

source some-functions
alias another-thing
export SVN_EDITOR=vim
RESET-ZSH # none of the above are valid any more

Is there such a built in possibility, or am I chasing butterflies?

share|improve this question
add comment

1 Answer

up vote 8 down vote accepted

You could just exec zsh, which will give you a fresh zsh and re-run the init functions. Note that you'd need to exec zsh -l for a login zsh to keep its "login shell" status. I don't know how well it preserves command history (it seems to work for me, but if you use multiple shells in different terminals you might get 'crosstalk' between the two shells' history)

share|improve this answer
    
Well that was simple :). Thanks. –  mhitza Jun 13 '11 at 2:34
    
That wouldn't undo exported environment variables, would it? (Although any that get set by your init file would be reset.) –  cjm Jun 13 '11 at 3:40
    
Probably it wouldn't. I hadn't considered that aspect because I wasn't thinking of environment variables as something you set temporarily in the shell. –  Random832 Jun 13 '11 at 3:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.