[Home] Zsh logo

zshenv

Zsh Wizard

Download zshenv Return to Examples
  1. #
  2. # Generic .zshenv file for zsh
  3. #
  4. # .zshenv is sourced on ALL invocations of the shell, unless the -f option is
  5. # set. It should NOT normally contain commands to set the command search path,
  6. # or other common environment variables unless you really know what you're
  7. # doing. E.g. running "PATH=/custom/path gdb program" sources this file (when
  8. # gdb runs the program via $SHELL), so you want to be sure not to override a
  9. # custom environment in such cases. Note also that .zshenv should not contain
  10. # commands that produce output or assume the shell is attached to a tty.
  11. #
  12. # THIS FILE IS NOT INTENDED TO BE USED AS /etc/zshenv, NOR WITHOUT EDITING
  13. return 0 # Remove this line after editing this file as appropriate
  14. # This kludge can be used to override some installations that put aliases for
  15. # rm, mv, etc. into the system profiles. Just be sure to put "unalias alias"
  16. # in your own rc file(s) if you use this.
  17. alias alias=:
  18. # Some people insist on setting their PATH here to affect things like ssh.
  19. # Those that do should probably use $SHLVL to ensure that this only happens
  20. # the first time the shell is started (to avoid overriding a customized
  21. # environment). Also, the various profile/rc/login files all get sourced
  22. # *after* this file, so they will override this value. One solution is to
  23. # put your path-setting code into a file named .zpath, and source it from
  24. # both here (if we're not a login shell) and from the .zprofile file (which
  25. # is only sourced if we are a login shell).
  26. if [[ $SHLVL == 1 && ! -o LOGIN ]]; then
  27. source ~/.zpath
  28. fi