diff --git a/bash-abbr b/bash-abbr index e2647c0..599c3d7 100644 --- a/bash-abbr +++ b/bash-abbr @@ -26,9 +26,11 @@ _control_op () { printf %s "$_control_op" unset -f _control_op } +# shellcheck disable=SC2155 declare _control_op="$(_control_op)" _redir_or_assign_word () { + # shellcheck disable=SC2016 declare -r _varredir_or_number='\{[[:alpha:]_][[:alnum:]_]*\}|[[:digit:]]*' \ _redir_in_or_out='>|<' \ _close_or_move_fd='&[[:digit:]]*-?' \ @@ -58,10 +60,12 @@ _redir_or_assign_word () { declare -r _word="($_part)+" \ _close_redirection="($_varredir_or_number)($_redir_in_or_out)($_close_or_move_fd)" \ _generic_redirection="($_redir_or_append_out_and_err|($_varredir_or_number)($_heredoc_herestring_in_out_etc))" + # shellcheck disable=SC1087 declare -r _word_redirection_or_assignment="($_generic_redirection[[:space:]]*|$_identifier_equals)($_word)" printf %s "$_close_redirection|$_word_redirection_or_assignment" unset -f _redir_or_assign_word } +# shellcheck disable=SC2155 declare -r _redir_or_assign_word="$(_redir_or_assign_word)" declare -r is_first_word_prefix="($_control_op)[[:space:]]*((($_redir_or_assign_word)[[:space:]])*)" @@ -125,6 +129,7 @@ _try_abbrev_internal () { # Strip special flags (or space) from the beginning of the replacement replacement=${replacement#[*$ -]} + # shellcheck disable=SC2015 [[ ${replacement: -1} = "!" ]] && declare -r eval_expansion=true || declare -r eval_expansion=false [[ ${replacement: -1} = "$" ]] && replacement=$(eval "${replacement%$}") @@ -149,6 +154,7 @@ _try_abbrev_internal () { # Update line. eval "$new_line"'=${line_until_point%"$word_at_point"}$replacement${self_insertion}${line:point}' else + # shellcheck disable=SC2034 declare -ir offset=${#self_insertion} # Self-insert by default