From 607527f2d20e40dea83a1fc6ead4ad37467c0f4c Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 29 Mar 2019 17:17:40 +1300 Subject: Fix up a few cosmetic shell anti-patterns --- zsh/zprofile | 4 +++- zsh/zshrc | 4 +++- zsh/zshrc.d/prompt.zsh | 7 ++++--- 3 files changed, 10 insertions(+), 5 deletions(-) (limited to 'zsh') diff --git a/zsh/zprofile b/zsh/zprofile index 65586fe2..614672ba 100644 --- a/zsh/zprofile +++ b/zsh/zprofile @@ -1,2 +1,4 @@ # Source ~/.profile, since Zsh doesn't do this by default -[[ -e $HOME/.profile ]] && source "$HOME"/.profile +if [[ -e $HOME/.profile ]] ; then + source "$HOME"/.profile +fi diff --git a/zsh/zshrc b/zsh/zshrc index 25d90ead..0aac527e 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -5,7 +5,9 @@ unalias -a >/dev/null 2>&1 # If ENV is set, source it to get all the POSIX-compatible interactive stuff -[[ -n $ENV ]] && source "$ENV" +if [[ -n $ENV ]] ; then + source "$ENV" +fi # Emacs keybindings even if EDITOR is vi(1) bindkey -e diff --git a/zsh/zshrc.d/prompt.zsh b/zsh/zshrc.d/prompt.zsh index 689866e3..980d8669 100644 --- a/zsh/zshrc.d/prompt.zsh +++ b/zsh/zshrc.d/prompt.zsh @@ -10,7 +10,7 @@ prompt() { # Basic prompt shape depends on whether we're in SSH or not PS1= - if [[ -n $SSH_CLIENT ]] || [[ -n $SSH_CONNECTION ]] ; then + if [[ -n $SSH_CLIENT || -n $SSH_CONNECTION ]] ; then PS1=$PS1'%m:' fi PS1=$PS1'%~' @@ -121,8 +121,9 @@ prompt() { fi # There are some untracked and unignored files - if git ls-files --directory --error-unmatch --exclude-standard \ - --no-empty-directory --others -- ':/*' ; then + if git ls-files --directory --error-unmatch \ + --exclude-standard --no-empty-directory \ + --others -- ':/*' ; then state=${state}'?' fi -- cgit v1.2.3