3 ms·
Don't overwrite the PROMPT_COMMAND like this, you risk breaking other tools such as autojump. Instead, append to it.
by joelthelion 15y ago
Don't overwrite the PROMPT_COMMAND like this, you risk breaking other tools such as autojump. Instead, append to it.
- pavel_lishin 15y agoHow?
- joelthelion 15y agoThis is how autojump does it: export PROMPT_COMMAND="$AUTOJUMP ; ${PROMPT_COMMAND:-:}"
- pavel_lishin 15y agoMy bash-fu is weak; can you break that down for me?
- zakj 15y ago${VARIABLE:-value} expands to the contents of $VARIABLE, if it exists, or to "value" otherwise. In this case value is ":", a bash builtin that does nothing. Effectively, the above sets PROMPT_COMMAND to run the autojump command, then to run the pre-existing PROMPT_COMMAND, if any, or a no-op.