diff --git a/emojify b/emojify index 5743626..4b70480 100755 --- a/emojify +++ b/emojify @@ -22,6 +22,15 @@ emojify_version=2.1.0 +version_error_message="Oh my! That’s a very old version of bash you’re using, we don’t support that anymore :( +Consider upgrading it or, if you must use bash ${BASH_VERSION}, download an old version of +emojify from here: https://github.com/mrowa44/emojify/blob/old_bash_support/emojify" +# Checks the installed bash version to see if it's compatible with emojify +if (( ${BASH_VERSION%%.*} < 4 )); then + echo -e "$version_error_message" + exit 1 +fi + # List generated by # https://gist.github.com/GrenderG/fd4eb4c73eadad219b0ecb5f9345070a#file-emoji_scrap-py # and emoji_scrap_github.py @@ -2860,18 +2869,6 @@ EOF exit 0 } -# Checks the installed bash version to see if it's compatible with emojify -check_version () { - if (( ${BASH_VERSION%%.*} >= 4 )); then - return - else - echo -e "Oh my! That’s a very old version of bash you’re using, we don’t support that anymore :(\n" \ - "\nConsider upgrading it or, if you must use bash ${BASH_VERSION} download an old version of" \ - "emojify from here: https://github.com/mrowa44/emojify/blob/old_bash_support/emojify" - exit 0 - fi -} - # If arguments are provided on the command line then check for supported help # options or process the arguments as emoji names. if [[ -n $1 ]]; then @@ -2889,12 +2886,10 @@ if [[ -n $1 ]]; then ;; * ) - check_version emojify_line "$*" ;; esac else - check_version while IFS=''; read -r line || [ -n "$line" ]; do emojify_line "$line" done