Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daniel-barlow/2765488bf3e52e04f9d734e227dbff56 to your computer and use it in GitHub Desktop.
Save daniel-barlow/2765488bf3e52e04f9d734e227dbff56 to your computer and use it in GitHub Desktop.
Line 13:
. /etc/sysconfig/network
^-- SC1091: Not following: /etc/sysconfig/network was not specified as input (see shellcheck -x).
Line 15:
if [ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" ]; then
^-- SC2166: Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.
Line 34:
. /etc/init.d/functions
^-- SC1091: Not following: /etc/init.d/functions was not specified as input (see shellcheck -x).
Line 50:
if [ -n "$SELINUX_STATE" -a -x /sbin/restorecon ] && __fgrep " /dev " /proc/mounts >/dev/null 2>&1 ; then
^-- SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
Line 65:
. /etc/selinux/config
^-- SC1091: Not following: /etc/selinux/config was not specified as input (see shellcheck -x).
Line 142:
/bin/taskset -p ${arg##default_affinity=} 1
^-- SC2086: Double quote to prevent globbing and word splitting.
Line 143:
/bin/taskset -p ${arg##default_affinity=} $$
^-- SC2086: Double quote to prevent globbing and word splitting.
Line 150:
[ -n "$nashpid" ] && kill $nashpid >/dev/null 2>&1
^-- SC2086: Double quote to prevent globbing and word splitting.
Line 159:
[ -x $file ] && $file
^-- SC2086: Double quote to prevent globbing and word splitting.
Line 177:
[ -n "${NISDOMAIN}" ] && domainname ${NISDOMAIN}
^-- SC2086: Double quote to prevent globbing and word splitting.
Line 191:
if ! strstr "$cmdline" nompath && [ -f /etc/multipath.conf -a \
^-- SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
Line 203:
if [ "$?" = "0" ]; then
^-- SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.
Line 216:
[ -r /proc/mdstat -a -r /dev/md/md-device-map ] && action $"Run MD devices: " /sbin/mdadm -IRs
^-- SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
Line 241:
[ -f /etc/sysconfig/autofsck ] && . /etc/sysconfig/autofsck
^-- SC1091: Not following: /etc/sysconfig/autofsck was not specified as input (see shellcheck -x).
Line 267:
. /etc/sysconfig/readonly-root
^-- SC1091: Not following: /etc/sysconfig/readonly-root was not specified as input (see shellcheck -x).
Line 278:
if [ "$READONLY" = "yes" -o "$TEMPORARY_STATE" = "yes" ]; then
^-- SC2166: Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.
Line 315:
elif [ x$rw_mount_dev != x ] && mount $rw_mount_dev $mountopts "$RW_MOUNT" > /dev/null 2>&1; then
^-- SC2086: Double quote to prevent globbing and word splitting.
^-- SC2086: Double quote to prevent globbing and word splitting.
Line 318:
mount -n -t tmpfs $RW_OPTIONS $mountopts none "$RW_MOUNT"
^-- SC2086: Double quote to prevent globbing and word splitting.
Line 323:
[ -f $file ] && cat $file | while read type path ; do
^-- SC2002: Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
^-- SC2086: Double quote to prevent globbing and word splitting.
^-- SC2162: read without -r will mangle backslashes.
^-- SC2086: Double quote to prevent globbing and word splitting.
Line 326:
mount_empty $path
^-- SC2086: Double quote to prevent globbing and word splitting.
Line 329:
mount_files $path
^-- SC2086: Double quote to prevent globbing and word splitting.
Line 332:
mount_dirs $path
^-- SC2086: Double quote to prevent globbing and word splitting.
Line 337:
[ -n "$SELINUX_STATE" -a -e "$path" ] && restorecon -R "$path"
^-- SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
Line 349:
if [ "$HOSTNAME" = "localhost" -o "$HOSTNAME" = "localhost.localdomain" ]; then
^-- SC2166: Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.
Line 353:
eval $(ipcalc -h $ip 2>/dev/null)
^-- SC2046: Quote this to prevent word splitting.
^-- SC2086: Double quote to prevent globbing and word splitting.
Line 369:
if mount $mountopts $STATE_OPTIONS "$STATE_MOUNT" > /dev/null 2>&1 ; then
^-- SC2086: Double quote to prevent globbing and word splitting.
Line 371:
elif [ x$state_mount_dev != x ] && mount $state_mount_dev $mountopts "$STATE_MOUNT" > /dev/null 2>&1; then
^-- SC2086: Double quote to prevent globbing and word splitting.
^-- SC2086: Double quote to prevent globbing and word splitting.
Line 377:
mount -t nfs $CLIENTSTATE/$HOSTNAME $STATE_MOUNT -o rw,nolock
^-- SC2086: Double quote to prevent globbing and word splitting.
Line 397:
for path in $(grep -v "^#" "$file" 2>/dev/null); do
^-- SC2013: To read lines rather than words, pipe/redirect to a 'while read' loop.
Line 399:
[ -n "$SELINUX_STATE" -a -e "$path" ] && restorecon -R "$path"
^-- SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
Line 404:
for path in $(grep -v "^#" "$STATE_MOUNT/files" 2>/dev/null); do
^-- SC2013: To read lines rather than words, pipe/redirect to a 'while read' loop.
Line 406:
[ -n "$SELINUX_STATE" -a -e "$path" ] && restorecon -R "$path"
^-- SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
Line 424:
if [ -z "$fastboot" -a "$READONLY" != "yes" ]; then
^-- SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
Line 428:
fsck -T -t noopts=_netdev -A $fsckoptions
^-- SC2086: Double quote to prevent globbing and word splitting.
Line 437:
elif [ "$rc" -eq "2" -o "$rc" -eq "3" ]; then
^-- SC2166: Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.
Line 499:
if [ -n "$SELINUX_STATE" -a "$READONLY" != "yes" ]; then
^-- SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
Line 501:
restorecon $(awk '!/^#/ && $4 !~ /noauto/ && $2 ~ /^\// { print $2 }' /etc/fstab) >/dev/null 2>&1
^-- SC2046: Quote this to prevent word splitting.
Line 507:
(> /etc/mtab) &> /dev/null
^-- SC2188: This redirection doesn't have a command. Move to its command (or use 'true' as no-op).
Line 532:
if [ -n "$SELINUX_STATE" -a "$READONLY" != "yes" ]; then
^-- SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
Line 537:
if [ -d /etc/selinux -a "$READONLY" != "yes" ]; then
^-- SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
Line 543:
if [ X"$_RUN_QUOTACHECK" = X1 -a -x /sbin/quotacheck ]; then
^-- SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
Line 594:
. /etc/sysconfig/network
^-- SC1091: Not following: /etc/sysconfig/network was not specified as input (see shellcheck -x).
Line 609:
[ -f /var/run/utmpx -o -f /var/log/wtmpx ] && _NEED_XFILES=1
^-- SC2166: Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.
Line 620:
> /var/run/utmp
^-- SC2188: This redirection doesn't have a command. Move to its command (or use 'true' as no-op).
Line 625:
> /var/run/utmpx
^-- SC2188: This redirection doesn't have a command. Move to its command (or use 'true' as no-op).
Line 641:
mkdir -m 1777 -p /tmp/.ICE-unix >/dev/null 2>&1
^-- SC2174: When used with -p, -m only applies to the deepest directory.
Line 649:
curswap=$(awk '/^\/dev/ { print $1 }' /proc/swaps | while read x; do get_numeric_dev dec $x ; echo -n " "; done)
^-- SC2162: read without -r will mangle backslashes.
^-- SC2086: Double quote to prevent globbing and word splitting.
Line 653:
[ ! -e $partition ] && continue
^-- SC2086: Double quote to prevent globbing and word splitting.
Line 654:
majmin=$(get_numeric_dev dec $partition)
^-- SC2086: Double quote to prevent globbing and word splitting.
Line 655:
echo $curswap | grep -qw "$majmin" || action $"Enabling local swap partitions: " swapon $partition
^-- SC2086: Double quote to prevent globbing and word splitting.
^-- SC2086: Double quote to prevent globbing and word splitting.
Line 668:
/usr/sbin/system-config-network-cmd --profile ${arg##netprofile=}
^-- SC2086: Double quote to prevent globbing and word splitting.
$
ShellCheck is...
GPLv3: free as in freedom
available on GitHub
already packaged for your distro or package manager
supported as an integrated linter in major editors
available in CodeClimate and Codacy to auto-check your GitHub repo
written in Haskell, if you're into that sort of thing.
Sounds awesome? Read more about it on the GitHub page!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment