Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is how autojump does it:

    export PROMPT_COMMAND="$AUTOJUMP ; ${PROMPT_COMMAND:-:}"


My bash-fu is weak; can you break that down for me?


${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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: