When I run codacy-analysis-cli analyze
command for the next line of script:
if [[ "$lexer_date" > "$lexer_ts_date" ]]; then
generate_grammar
fi
I got the next warning:
Found [Warning] `In POSIX sh, [[ ]] is undefined.` in scripts/grammar.sh:20 (shellcheck_SC2039)
How can I fix it?
Use [
instead. Note that for alphanumeric comparisons you need to quote the comparison operator; thus:
if [ "$lexer_date" ">" "$lexer_ts_date" ]; then
generate_grammar
fi