In /usr/bin/hwloc-gather-topology line 15:
localstatedir="/var"
^-----------^ SC2034: localstatedir appears unused. Verify use (or export if used externally).


In /usr/bin/hwloc-gather-topology line 42:
    echo $@ 2>&1
         ^-- SC2068: Double quote array expansions to avoid re-splitting elements.


In /usr/bin/hwloc-gather-topology line 59:
while [ x`echo "$1" | cut -c1` = x- ] ; do
         ^-------------------^ SC2046: Quote this to prevent word splitting.
         ^-------------------^ SC2006: Use $(...) notation instead of legacy backticked `...`.

Did you mean: 
while [ x$(echo "$1" | cut -c1) = x- ] ; do


In /usr/bin/hwloc-gather-topology line 71:
if test $# -lt 1 -o x$1 = x; then
                     ^-- SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
if test $# -lt 1 -o x"$1" = x; then


In /usr/bin/hwloc-gather-topology line 76:
basename=`basename "$name"`
         ^----------------^ SC2006: Use $(...) notation instead of legacy backticked `...`.

Did you mean: 
basename=$(basename "$name")


In /usr/bin/hwloc-gather-topology line 77:
dirname=`dirname "$name"`
        ^---------------^ SC2006: Use $(...) notation instead of legacy backticked `...`.

Did you mean: 
dirname=$(dirname "$name")


In /usr/bin/hwloc-gather-topology line 100:
destdir=`mktemp -d --tmpdir hwloc-gather-topology.XXXXXXXX`
        ^-- SC2006: Use $(...) notation instead of legacy backticked `...`.

Did you mean: 
destdir=$(mktemp -d --tmpdir hwloc-gather-topology.XXXXXXXX)


In /usr/bin/hwloc-gather-topology line 105:
  local dest="$1"
  ^--------^ SC2039: In POSIX sh, 'local' is undefined.


In /usr/bin/hwloc-gather-topology line 106:
  local file="$2"
  ^--------^ SC2039: In POSIX sh, 'local' is undefined.


In /usr/bin/hwloc-gather-topology line 108:
    dir=`dirname "$file"`
        ^---------------^ SC2006: Use $(...) notation instead of legacy backticked `...`.

Did you mean: 
    dir=$(dirname "$file")


In /usr/bin/hwloc-gather-topology line 115:
  local dest="$1"
  ^--------^ SC2039: In POSIX sh, 'local' is undefined.


In /usr/bin/hwloc-gather-topology line 116:
  local file="$2"
  ^--------^ SC2039: In POSIX sh, 'local' is undefined.


In /usr/bin/hwloc-gather-topology line 117:
  dir=`dirname "$file"`
      ^---------------^ SC2006: Use $(...) notation instead of legacy backticked `...`.

Did you mean: 
  dir=$(dirname "$file")


In /usr/bin/hwloc-gather-topology line 124:
  local dest="$1"
  ^--------^ SC2039: In POSIX sh, 'local' is undefined.


In /usr/bin/hwloc-gather-topology line 125:
  local file="$2"
  ^--------^ SC2039: In POSIX sh, 'local' is undefined.


In /usr/bin/hwloc-gather-topology line 134:
  local dest="$1"
  ^--------^ SC2039: In POSIX sh, 'local' is undefined.


In /usr/bin/hwloc-gather-topology line 135:
  local path="$2"
  ^--------^ SC2039: In POSIX sh, 'local' is undefined.


In /usr/bin/hwloc-gather-topology line 153:
  local dest="$1"
  ^--------^ SC2039: In POSIX sh, 'local' is undefined.


In /usr/bin/hwloc-gather-topology line 154:
  local classname="$2"
  ^-------------^ SC2039: In POSIX sh, 'local' is undefined.


In /usr/bin/hwloc-gather-topology line 156:
  test -d /sys/class/$classname/ || return
                     ^--------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
  test -d /sys/class/"$classname"/ || return


In /usr/bin/hwloc-gather-topology line 158:
  savedir "$dest" /sys/class/$classname/
                             ^--------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
  savedir "$dest" /sys/class/"$classname"/


In /usr/bin/hwloc-gather-topology line 160:
  for dev in $(ls /sys/class/$classname/); do
             ^--------------------------^ SC2045: Iterating over ls output is fragile. Use globs.
                             ^--------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
  for dev in $(ls /sys/class/"$classname"/); do


In /usr/bin/hwloc-gather-topology line 161:
    target=$(readlink /sys/class/$classname/$dev 2>/dev/null | grep -v /devices/pci)
                                 ^--------^ SC2086: Double quote to prevent globbing and word splitting.
                                            ^--^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
    target=$(readlink /sys/class/"$classname"/"$dev" 2>/dev/null | grep -v /devices/pci)


In /usr/bin/hwloc-gather-topology line 165:
    device=$(readlink /sys/class/$classname/$target/device 2>/dev/null | grep -v /devices/pci)
                                 ^--------^ SC2086: Double quote to prevent globbing and word splitting.
                                            ^-----^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
    device=$(readlink /sys/class/"$classname"/"$target"/device 2>/dev/null | grep -v /devices/pci)


In /usr/bin/hwloc-gather-topology line 174:
  local dest="$1"
  ^--------^ SC2039: In POSIX sh, 'local' is undefined.


In /usr/bin/hwloc-gather-topology line 175:
  local busname="$2"
  ^-----------^ SC2039: In POSIX sh, 'local' is undefined.


In /usr/bin/hwloc-gather-topology line 176:
  local relpath="$3"
  ^-----------^ SC2039: In POSIX sh, 'local' is undefined.


In /usr/bin/hwloc-gather-topology line 178:
  test -d /sys/bus/$busname/devices/ || return
                   ^------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
  test -d /sys/bus/"$busname"/devices/ || return


In /usr/bin/hwloc-gather-topology line 180:
  savedir "$dest" /sys/bus/$busname/devices/
                           ^------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
  savedir "$dest" /sys/bus/"$busname"/devices/


In /usr/bin/hwloc-gather-topology line 182:
  for dev in $(ls /sys/bus/$busname/devices/); do
             ^-- SC2045: Iterating over ls output is fragile. Use globs.
                           ^------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
  for dev in $(ls /sys/bus/"$busname"/devices/); do


In /usr/bin/hwloc-gather-topology line 183:
    target=$(readlink /sys/bus/$busname/devices/$dev 2>/dev/null | grep -v /devices/pci)
                               ^------^ SC2086: Double quote to prevent globbing and word splitting.
                                                ^--^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
    target=$(readlink /sys/bus/"$busname"/devices/"$dev" 2>/dev/null | grep -v /devices/pci)


In /usr/bin/hwloc-gather-topology line 187:
    device=$(readlink /sys/bus/$busname/devices/$target/$relpath/device 2>/dev/null | grep -v /devices/pci)
                               ^------^ SC2086: Double quote to prevent globbing and word splitting.
                                                ^-----^ SC2086: Double quote to prevent globbing and word splitting.
                                                        ^------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
    device=$(readlink /sys/bus/"$busname"/devices/"$target"/"$relpath"/device 2>/dev/null | grep -v /devices/pci)


In /usr/bin/hwloc-gather-topology line 200:
  local encodedpath=$1
  ^---------------^ SC2039: In POSIX sh, 'local' is undefined.
        ^---------^ SC2034: encodedpath appears unused. Verify use (or export if used externally).


In /usr/bin/hwloc-gather-topology line 205:
  local path=$(echo "$1" | sed -e 's@\\134@\\@g' -e 's@\\040@ @g' -e 's@\\011@	@g')
  ^--------^ SC2039: In POSIX sh, 'local' is undefined.
        ^--^ SC2155: Declare and assign separately to avoid masking return values.


In /usr/bin/hwloc-gather-topology line 260:
  else if test -e "$destdir/$basename/$runstatedir/hwloc"; then
  ^-- SC1075: Use 'elif' instead of 'else if' (or put 'if' on new line if nesting).


In /usr/bin/hwloc-gather-topology line 266:
cat /proc/mounts | while read -r dummy1 mntpath mnttype mntopts dummy2 ; do
    ^----------^ SC2002: Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
                                 ^----^ SC2034: dummy1 appears unused. Verify use (or export if used externally).
                                                                ^----^ SC2034: dummy2 appears unused. Verify use (or export if used externally).


In /usr/bin/hwloc-gather-topology line 267:
  [ x$mnttype = xcpuset ] && savemntpnt "$mntpath"
     ^------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
  [ x"$mnttype" = xcpuset ] && savemntpnt "$mntpath"


In /usr/bin/hwloc-gather-topology line 268:
  [ x$mnttype = xcgroup ] && echo $mntopts | grep -w cpuset >/dev/null && savemntpnt "$mntpath"
     ^------^ SC2086: Double quote to prevent globbing and word splitting.
                                  ^------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
  [ x"$mnttype" = xcgroup ] && echo "$mntopts" | grep -w cpuset >/dev/null && savemntpnt "$mntpath"


In /usr/bin/hwloc-gather-topology line 269:
  [ x$mnttype = xcgroup2 ] && savemntpnt "$mntpath"
     ^------^ SC2086: Double quote to prevent globbing and word splitting.

Did you mean: 
  [ x"$mnttype" = xcgroup2 ] && savemntpnt "$mntpath"


In /usr/bin/hwloc-gather-topology line 280:
  ls -d /sys/devices/pci* 2>/dev/null | while read -r path ; do savedir "$destdir/$basename" "$path" ; done
  ^-- SC2012: Use find instead of ls to better handle non-alphanumeric filenames.


In /usr/bin/hwloc-gather-topology line 291:
  ls -d /run/udev/data/b* 2>/dev/null | while read -r path ; do savefile "$destdir/$basename" "$path" ; done
  ^-- SC2012: Use find instead of ls to better handle non-alphanumeric filenames.


In /usr/bin/hwloc-gather-topology line 314:
if [ x$gathercpuid = x1 -a -e "$hgcpuid" ]; then
                        ^-- SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.

For more information:
  https://www.shellcheck.net/wiki/SC1075 -- Use 'elif' instead of 'else if' (...
  https://www.shellcheck.net/wiki/SC2045 -- Iterating over ls output is fragi...
  https://www.shellcheck.net/wiki/SC2068 -- Double quote array expansions to ...