MissouriMRDT / Autonomy_Software

Avoid use of ls | grep SH-2010
Anti-pattern
Major
1 occurrence in this check
Don't use ls | grep. Use a glob or a for loop with a condition to allow non-alphanumeric filenames
 9# Determine the next available comment number
10if [ "$(ls -A comments)" ]; then
11    # Find the highest numbered comment file and set the comment_counter accordingly
12    comment_counter=$(ls comments | grep -Eo '[0-9]+' | sort -n | tail -1)13    comment_counter=$((comment_counter + 1))
14else
15    comment_counter=1