rcaloras/bash-preexec

Return immediately when running in Zsh

FranklinYu opened this issue · 3 comments

This might sound weird, but some users choose to source this script for both Bash and Zsh. I think it doesn’t harm to have something like this in the beginning:

if [[ -n $ZSH_NAME ]]; then
    return
fi

@FranklinYu thanks for the feedback! This should already be accounted for in:

# Make sure this is bash that's running this and return otherwise.
if [[ -z "${BASH_VERSION:-}" ]]; then
return 1;
fi

This line should effectively cause this script to exit with 1 when trying to source with zsh or any shell other than Bash. Please let me know if I'm mistaken.

Thank you very much. I have noticed this line, but it is very late in the script. At that time all the functions and variables are already there. How about moving this 4 lines to the top?

Noticed this when you first posted, but didn't give it much thought. Thanks for the feedback! Updated in #114 Let me know if you have something else in mind.