From 41a3077ff081400b3391e5bfb02533715364b167 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Thu, 24 May 2018 09:40:02 -0700 Subject: Improve shell script with shellcheck --- setpath.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'setpath.sh') diff --git a/setpath.sh b/setpath.sh index 29b94ea..d47d61c 100644 --- a/setpath.sh +++ b/setpath.sh @@ -1,16 +1,18 @@ #!/usr/bin/env sh # add some useful stuff to my path (if present) -OLDPATH=$PATH for DIR in \ $HOME/bin \ $HOME/me/bin \ $HOME/.local/bin do - if [ -d $DIR ] then + if [ -d "$DIR" ]; then PATH=$DIR:$PATH fi done # source nix.sh if present -[[ -f ~/.nix-profile/etc/profile.d/nix.sh ]] && . ~/.nix-profile/etc/profile.d/nix.sh +if [ -f ~/.nix-profile/etc/profile.d/nix.sh ]; then + # shellcheck source=/home/ben/.nix-profile/etc/profile.d/nix.sh + . ~/.nix-profile/etc/profile.d/nix.sh +fi -- cgit v1.2.3