Browse Source

Make possible to source ~/.zshrc if it exists

Emmanuel Bouthenot 6 years ago
parent
commit
7b559d04c9
1 changed files with 19 additions and 1 deletions
  1. 19 1
      zsh/zshrc

+ 19 - 1
zsh/zshrc

@@ -9,10 +9,15 @@ if [[ "${DISABLE_DOTFILES_SYS}" = 1 ]]; then
     return
 fi
 
+#
+# HOMEDIR
+#
+export HOMEDIR="$(getent passwd "${USER}" | cut -d: -f6)"
+
 #
 # TMPDIR
 #
-export TMPDIR="$(getent passwd "${USER}" | cut -d: -f6)/tmp"
+export TMPDIR="${HOMEDIR}/tmp"
 if [[ ! -d "${TMPDIR}" ]]; then
     mkdir -p "${TMPDIR}"
 fi
@@ -255,3 +260,16 @@ alias bower="HOME=${HOME}/tmp bower"
 alias gulp="HOME=${HOME}/tmp gulp"
 alias yarn="HOME=${HOME}/tmp yarn"
 
+# Sourcing ~/.zshrc
+
+ZSHRC="${HOMEDIR}/.zshrc"
+
+if [ -f "${ZSHRC}" ]; then
+    . "${ZSHRC}"
+fi
+
+# Cleanup
+
+unset ZSHRC
+unset HOMEDIR
+