diff --git a/runcoms/zprofile b/runcoms/zprofile index 2fe10b57..04742d1f 100644 --- a/runcoms/zprofile +++ b/runcoms/zprofile @@ -66,11 +66,11 @@ fi # Temporary Files # # -if [[ -z "$TMPDIR" ]]; then - export TMPDIR="/tmp/zsh-$UID" +# Set TMPDIR if the variable is not set/empty or the directory doesn't exist +if [[ -z "${TMPDIR}" ]]; then + export TMPDIR="/tmp/zsh-${UID}" fi -if [[ ! -d "$TMPDIR" ]]; then - mkdir "$TMPDIR" - chmod 700 "$TMPDIR" +if [[ ! -d "${TMPDIR}" ]]; then + mkdir -m 700 "${TMPDIR}" fi diff --git a/runcoms/zshenv b/runcoms/zshenv index 2d972031..eb16f5d6 100644 --- a/runcoms/zshenv +++ b/runcoms/zshenv @@ -6,6 +6,6 @@ # # Ensure that a non-login, non-interactive shell has a defined environment. -if [[ "$SHLVL" -eq 1 && ! -o LOGIN && -s "${ZDOTDIR:-$HOME}/.zprofile" ]]; then +if [[ ( "$SHLVL" -eq 1 && ! -o LOGIN || -z "${TMPDIR}" ) && -s "${ZDOTDIR:-$HOME}/.zprofile" ]]; then source "${ZDOTDIR:-$HOME}/.zprofile" fi