Skip to content

ShellCheck Errors in audio_common.sh Scripts Need to be Addressed #329

@smuppand

Description

@smuppand

Static analysis using ShellCheck has identified multiple issues across the audio_common.sh file. It is recommended to resolve these issues to ensure robustness of test automation scripts

In audio_common.sh line 212:
    sleep 1; t=$(expr $t + 1)
                 ^--^ SC2003 (style): expr is antiquated. Consider rewriting this using $((..)), ${} or [[ ]].


In audio_common.sh line 347:
        elapsed=$(expr $elapsed + $poll_interval)
                  ^--^ SC2003 (style): expr is antiquated. Consider rewriting this using $((..)), ${} or [[ ]].


In audio_common.sh line 349:
        if [ "$(expr $elapsed % 10)" -eq 0 ]; then
                ^--^ SC2003 (style): expr is antiquated. Consider rewriting this using $((..)), ${} or [[ ]].
                     ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
        if [ "$(expr "$elapsed" % 10)" -eq 0 ]; then


In audio_common.sh line 750:
      result=$(expr $h_val \* 3600 + $m_val \* 60 + $s_val)
               ^--^ SC2003 (style): expr is antiquated. Consider rewriting this using $((..)), ${} or [[ ]].
                    ^----^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                     ^----^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                    ^----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
      result=$(expr "$h_val" \* 3600 + "$m_val" \* 60 + "$s_val")


In audio_common.sh line 759:
          n=$(printf '%s' "$norm" | sed -n 's/^\([0-9][0-9]*\).*/\1/p'); printf '%s\n' "$(expr $n \* 60)"; return 0 ;;
                                                                                          ^--^ SC2003 (style): expr is antiquated. Consider rewriting thi
                                                                                               ^-- SC2086 (info): Double quote to prevent globbing and wo

Did you mean:
          n=$(printf '%s' "$norm" | sed -n 's/^\([0-9][0-9]*\).*/\1/p'); printf '%s\n' "$(expr "$n" \* 60)"; return 0 ;;


In audio_common.sh line 761:
          n=$(printf '%s' "$norm" | sed -n 's/^\([0-9][0-9]*\).*/\1/p'); printf '%s\n' "$(expr $n \* 3600)"; return 0 ;;
                                                                                          ^--^ SC2003 (style): expr is antiquated. Consider rewriting thi
                                                                                               ^-- SC2086 (info): Double quote to prevent globbing and wo

Did you mean:
          n=$(printf '%s' "$norm" | sed -n 's/^\([0-9][0-9]*\).*/\1/p'); printf '%s\n' "$(expr "$n" \* 3600)"; return 0 ;;


In audio_common.sh line 770:
              m|min|mins|minute|minutes) add=$(expr $n \* 60) ;;
                                               ^--^ SC2003 (style): expr is antiquated. Consider rewriting this using $((..)), ${} or [[ ]].
                                                    ^-- SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
              m|min|mins|minute|minutes) add=$(expr "$n" \* 60) ;;


In audio_common.sh line 771:
              h|hr|hrs|hour|hours)       add=$(expr $n \* 3600) ;;
                                               ^--^ SC2003 (style): expr is antiquated. Consider rewriting this using $((..)), ${} or [[ ]].
                                                    ^-- SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
              h|hr|hrs|hour|hours)       add=$(expr "$n" \* 3600) ;;


In audio_common.sh line 774:
            total=$(expr $total + $add); ok=1
                    ^--^ SC2003 (style): expr is antiquated. Consider rewriting this using $((..)), ${} or [[ ]].
                                  ^--^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
            total=$(expr $total + "$add"); ok=1


In audio_common.sh line 813:
  deadline="$(expr "$start" + "$dur_norm" 2>/dev/null || echo 0)"
              ^--^ SC2003 (style): expr is antiquated. Consider rewriting this using $((..)), ${} or [[ ]].


In audio_common.sh line 834:
      grace="$(expr "$grace" + 1)"
               ^--^ SC2003 (style): expr is antiquated. Consider rewriting this using $((..)), ${} or [[ ]].


In audio_common.sh line 868:
    i="$(expr "$i" + 1)"
         ^--^ SC2003 (style): expr is antiquated. Consider rewriting this using $((..)), ${} or [[ ]].


In audio_common.sh line 1117:
  set -- $metadata
         ^-------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
  set -- "$metadata"


In audio_common.sh line 1141:
  set -- $metadata
         ^-------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
  set -- "$metadata"

In audio_common.sh line 1210:
    set -- $available_clips
           ^--------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
    set -- "$available_clips"


In audio_common.sh line 1222:
      current_idx=$(expr $current_idx + 1)
                    ^--^ SC2003 (style): expr is antiquated. Consider rewriting this using $((..)), ${} or [[ ]].


In audio_common.sh line 1244:
  set -- $available_clips
         ^--------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
  set -- "$available_clips"

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions