From 87a7e51c394c0e685dcbfe88fcfc792cc1d471af Mon Sep 17 00:00:00 2001 From: zugzug Date: Thu, 17 Mar 2016 09:03:44 -0700 Subject: [PATCH] FIX make autolist work if PROMPT_COMMAND is blank Before this change, autolist fails w/ the following error when PROMPT_COMMAND is not set: -bash: PROMPT_COMMAND: line 0: syntax error near unexpected token `;' -bash: PROMPT_COMMAND: line 0: `;eval "na --prompt"' --- na.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/na.sh b/na.sh index 512597a..f268a71 100644 --- a/na.sh +++ b/na.sh @@ -302,5 +302,9 @@ WEEDTIME } if [[ $NA_AUTO_LIST_FOR_DIR -eq 1 ]]; then - echo $PROMPT_COMMAND | grep -v -q "na --prompt" && PROMPT_COMMAND="$PROMPT_COMMAND;"'eval "na --prompt"' + if [[ -z "$PROMPT_COMMAND" ]]; then + PROMPT_COMMAND="eval 'na --prompt'" + else + echo $PROMPT_COMMAND | grep -v -q "na --prompt" && PROMPT_COMMAND="$PROMPT_COMMAND;"'eval "na --prompt"' + fi fi