arch-install-scripts icon indicating copy to clipboard operation
arch-install-scripts copied to clipboard

Fix shellcheck errors and warnings

Open oxr463 opened this issue 3 years ago • 0 comments

shellcheck genfstab
 
Line 51:
out() { printf "$1 $2\n" "${@:3}"; }
               ^-- SC2059: Don't use variables in the printf format string. Use printf '..%s..' "$foo".
 
Line 72:
  local i= chr= out=
         ^-- SC1007: Remove space after = if trying to assign a value (for empty string, use var='' ... ).
              ^-- SC1007: Remove space after = if trying to assign a value (for empty string, use var='' ... ).
 
Line 90:
  local i= chr= out= len=$(( ${#1} - 4 ))
         ^-- SC1007: Remove space after = if trying to assign a value (for empty string, use var='' ... ).
              ^-- SC1007: Remove space after = if trying to assign a value (for empty string, use var='' ... ).
                   ^-- SC1007: Remove space after = if trying to assign a value (for empty string, use var='' ... ).
 
Line 164:
  local options_=$1
        ^-- SC2178: Variable was used as an array but is now assigned a string.
 
Line 194:
  read dm_name <"/sys/class/block/${1#/dev/}/dm/name"
  ^-- SC2162: read without -r will mangle backslashes.
 
Line 215:
  local src=$1 spec= label= uuid= comment=()
                   ^-- SC1007: Remove space after = if trying to assign a value (for empty string, use var='' ... ).
                          ^-- SC1007: Remove space after = if trying to assign a value (for empty string, use var='' ... ).
                                ^-- SC1007: Remove space after = if trying to assign a value (for empty string, use var='' ... ).
 
Line 243:
  [[ $comment ]] && printf '# %s\n' "${comment[*]}"
     ^-- SC2128: Expanding an array without an index only gives the first element.
 
Line 276:
      if optstring_get_option "$varname" codepage && [[ $codepage = cp* ]]; then
                                                        ^-- SC2154: codepage is referenced but not assigned.
 
Line 417:
  read
  ^-- SC2162: read without -r will mangle backslashes.

Reference(s):

  • https://github.com/glacion/genfstab/issues/1

oxr463 avatar Mar 03 '22 15:03 oxr463