ko1nksm / getoptions

An elegant option/argument parser for shell scripts (full support for bash and all POSIX shells)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix SC2004

noraworld opened this issue · comments

When I use getoptions, I always have to manually ignore SC2004 that ShellCheck points out.

In foo line 62:
          REST="${REST} \"\${$(($OPTIND-$#))}\""
                                ^-----^ SC2004 (style): $/${} is unnecessary on arithmetic variables.


In foo line 68:
        REST="${REST} \"\${$(($OPTIND-$#))}\""
                              ^-----^ SC2004 (style): $/${} is unnecessary on arithmetic variables.

For more information:
  https://www.shellcheck.net/wiki/SC2004 -- $/${} is unnecessary on arithmeti...
    59	      --)
    60	        shift
    61	        while [ $# -gt 0 ]; do
*   62	          REST="${REST} \"\${$(($OPTIND-$#))}\""
    63	          shift
    64	        done
    65	        break ;;
    66	      [-]?*) set "unknown" "$1"; break ;;
    67	      *)
*   68	        REST="${REST} \"\${$(($OPTIND-$#))}\""
    69	    esac
    70	    shift
    71	  done

Is it possible to fix this?