Skip to content

Commit 9d9257b

Browse files
committed
github-cicd: shellcheck: fix a few SC2290, SC2145, SC2148
1 parent 80172f3 commit 9d9257b

22 files changed

+61
-9
lines changed

files/homes.desktop/bin/paswitch

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ echocolour() {
6666
esac
6767
shift
6868
done
69+
# shellcheck disable=SC2145 # I know how fixed_"$@" behaves and it's correct!
6970
log "$@${normal}"
7071
}
7172

@@ -201,7 +202,7 @@ function set_all_current_active_sinks() {
201202
# echo application_name=$application_name
202203

203204
inputs="$inputs $index"
204-
done < <( pactl list sink-inputs | grep -e '^Sink Input' -e 'application.name = ' ) # -e State: -e Flags:
205+
done < <( pactl list sink-inputs | grep -e '^Sink Input' -e 'application.name = ' ) # -e State: -e Flags:
205206
# FIXME: sink, card, state can be obtained from `pactl list sources short`, flags from `pactl list sinks | grep -i flag`
206207
# FLAG, STATE from `pactl list sinks | grep -i -e flag -e state`
207208
# sink-inputs gets name but not state, flags; sinks gets flag, state but not name;

files/homes.desktop/bin/runxscreensaver-monitor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ restart_xscreensaver() {
3838

3939
notify " - Will restart xscreensaver"
4040
systemctl --user restart runxscreensaver.service
41-
echo " *** $@"
41+
echo " ***" "$@"
4242
}
4343

4444
export PATH=$PATH:$HOME/bin

files/homes/.bashrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# -*- Mode: shell-script -*-
2+
# shellcheck shell=bash
23

34
# User specific environment and startup programs
45

files/tree/etc/bash.bashrc.d/0-detect-system.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- Mode: shell-script -*-
2-
2+
# shellcheck shell=bash
33

44
#set -x
55

files/tree/etc/bash.bashrc.d/0-first-bashrc.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# -*- Mode: shell-script -*-
2+
# shellcheck shell=bash
3+
14
function sh_interactive () {
25
case "$-" in
36
*i*)

files/tree/etc/bash.bashrc.d/helpers.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# -*- Mode: shell-script -*-
2+
# shellcheck shell=bash
3+
14
# https://stackoverflow.com/questions/68768860/how-to-print-all-function-calling-orders-in-a-bash-script
25

36
# http://wiki.bash-hackers.org/commands/builtin/caller

files/tree/etc/bash.bashrc.d/history.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# -*- Mode: shell-script -*-
2+
# shellcheck shell=bash
3+
14
function exitcleanly() {
25
# exiting=true
36
# cancel all traps we set up ourselves to manage prompt and history:

files/tree/etc/bash.bashrc.d/prompt.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# -*- Mode: shell-script -*-
2+
# shellcheck shell=bash
3+
14
# We've long appended our bash history upon a command running, using
25
# various methods. `trap '...' DEBUG` was causing us to have to write
36
# lots of code just to make sure the command being tested was a user
@@ -196,7 +199,7 @@ else
196199
fi
197200

198201
local me="${USER}"@"${SHORTHOST}"
199-
if [ $REALHOST != $LONGHOST ] ; then
202+
if [ "$REALHOST" != "$LONGHOST" ] ; then
200203
me="${USER}"@"${REALHOST}"
201204
fi
202205
winname "$EXTRA_TITLE`date +%d/%m-%H:%M:%S` -- $PTS -- $cmd -- ${me}: `chomp --escapechars --right ... $((COLUMNS-60)) ${shortpwd}`" ;
@@ -205,7 +208,7 @@ else
205208
function setprompt () {
206209
local shortpwd="${PWD/$HOME/~}"
207210
local me="${USER}"@"${SHORTHOST}"
208-
if [ $REALHOST != $LONGHOST ] ; then
211+
if [ "$REALHOST" != "$LONGHOST" ] ; then
209212
me="${USER}"@"${REALHOST}"
210213
fi
211214
local bold="\\[$ESC[7m\\]"

files/tree/etc/bash.bashrc.d/setpath.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# -*- Mode: shell-script -*-
2+
# shellcheck shell=bash
3+
14
# constructs PATH paying attention to not add anything that is not
25
# currently quickly accesible over NFS for example
36

files/tree/etc/bash.bashrc.d/setup-aliases.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# -*- Mode: shell-script -*-
2+
# shellcheck shell=bash
3+
14
# some aliases are always loaded regardless of what kind of login session
25
alias l='ls -lA'
36

@@ -33,7 +36,9 @@ function setup_aliases() {
3336
alias p='pstree -ap tconnors'
3437
alias pavucontrol='DBUS_SESSION_BUS_ADDRESS= pavucontrol' # https://gitlab.freedesktop.org/pulseaudio/pavucontrol/-/issues/75#note_1467143
3538
alias bc='bc -l'
39+
# shellcheck disable=SC2290 # incorrect interpretation of what the code is successfully doing: setting aliases to the "-" and "+" commands
3640
alias -- +='pushd .'
41+
# shellcheck disable=SC2290 # incorrect interpretation of what the code is successfully doing: setting aliases to the "-" and "+" commands
3742
alias -- -='popd'
3843
alias bd='popd'
3944
alias ..='cd ..'

files/tree/etc/bash.bashrc.d/setup-bash-settings.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# -*- Mode: shell-script -*-
2+
# shellcheck shell=bash
3+
14
setup_bash_settings() {
25
# echo setup_bash_settings 1>&2
36
setup_bash_history_settings

files/tree/etc/bash.bashrc.d/setup-display.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# -*- Mode: shell-script -*-
2+
# shellcheck shell=bash
3+
14
function setup_display() {
25
if [ -n "$DISPLAY" ] ; then
36
# stop trying to store masses of keys in NFS $HOME - just start

files/tree/etc/bash.bashrc.d/setup-environment.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# -*- Mode: shell-script -*-
2+
# shellcheck shell=bash
3+
14
# add all the other bash settings we care about, paths, etc, that
25
# would normally have gone in .bash_profile
36
function setup_environment() {

files/tree/etc/bash.bashrc.d/setup-remote-aliases.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# -*- Mode: shell-script -*-
2+
# shellcheck shell=bash
3+
14
function setup_remote_aliases() {
25
alias marvin-jump='background rgb:04/11/33 ; ssh marvin-jump ; background black'
36
alias hactar-jump=marvin-jump

files/tree/etc/bash.bashrc.d/sillysu.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# -*- Mode: shell-script -*-
2+
# shellcheck shell=bash
3+
14
function sillysu() {
25
if [ -n "$DISPLAY" ] ; then
36
command cp -a $XAUTHORITY /tmp/.$USER.Xauthority.tmp # this temporary file is pulled in by root's login scripts

files/tree/etc/bash.bashrc.d/tsocks.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# -*- Mode: shell-script -*-
2+
# shellcheck shell=bash
3+
14
function ontsocks() {
25
#FIXME: if 64 bit apps start being needed, may eventually compile for 64 bit, and then move it into ~/.../sparcv9/ (or /64/), and then remove this hack. Maybe just need to have both versions, and set $LD_PRELOAD, and it will pick it the correct version in the correct path
36
#FIXME: in fact, the whole hack can probably be removed, since solaris can probably deal with the different 32/64 bit paths in $LD_LIBRARY_PATH implicitly too, and just setting LD_PRELOAD to libtsocks without an explicit path
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# -*- Mode: shell-script -*-
2+
# shellcheck shell=bash
3+
14
if [ -n "$NONINTERACT" ] ; then
25
setup_environment
36
fi

files/tree/usr/local/bin/colorize

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ usage() {
8686

8787
usageerror() {
8888
if [ "$#" != 0 ] ; then
89-
echo "Usage error: $@" 1>&2
89+
echo "Usage error:" "$@" 1>&2
9090
echo "Usage was $ARGS" 1>&2
9191
fi
9292
usage 1

files/tree/usr/local/bin/colorizecommand

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ usage() {
7171

7272
usageerror() {
7373
if [ "$#" != 0 ] ; then
74-
echo "Usage error: $@" 1>&2
74+
echo "Usage error:" "$@" 1>&2
7575
echo "Usage was $ARGS" 1>&2
7676
fi
7777
usage 1

files/tree/usr/local/bin/statusbeep

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
if [ $# -ne 3 ] ; then
1212
echo "Usage: $0 <status> <newtime> <oldtime>" 1>&2
13-
echo "Usage was $@" 1>&2
13+
echo "Usage was" "$@" 1>&2
1414
exit 1
1515
fi
1616

roles/nutserver/files/upssched-cmd

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,46 @@
1212

1313
case $1 in
1414
upsgone)
15-
echo "The UPS has been gone for awhile: $@, $NOTIFYTYPE, $UPSNAME" | mail -s "UPS warning gone, $UPSNAME" tconnors
15+
# shellcheck disable=SC2145 # I know how fixed_"$@" behaves and it's correct!
16+
echo "The UPS has been gone for a while: ""$@"", $NOTIFYTYPE, $UPSNAME" | mail -s "UPS warning gone, $UPSNAME" tconnors
1617
;;
1718
onbattwarn)
19+
# shellcheck disable=SC2145 # I know how fixed_"$@" behaves and it's correct!
1820
echo "The UPS is currently running on battery power! $@, $NOTIFYTYPE, $UPSNAME" | mail -s "UPS warning on batt, $UPSNAME" tconnors
1921
#echo "We will shut down" | mail -s "upscched-cmd: UPS temporary workaround to shutdown machine on mains power" tconnors
2022
# need to run as root, but we're trying to shut down the UPS as well - the web says nut does this automatically
2123
#/usr/sbin/upsmon -c fsd
2224
;;
2325
online)
26+
# shellcheck disable=SC2145 # I know how fixed_"$@" behaves and it's correct!
2427
echo "The UPS is OK now! $@, $NOTIFYTYPE, $UPSNAME" | mail -s "UPS OK, $UPSNAME" tconnors
2528
;;
2629
fsd)
30+
# shellcheck disable=SC2145 # I know how fixed_"$@" behaves and it's correct!
2731
echo "FSD: $@, $NOTIFYTYPE, $UPSNAME" | mail -s "UPS warning FSD, $UPSNAME" tconnors
2832
# echo "We will shut down" | mail -s "upscched-cmd: UPS temporary workaround to shutdown machine on mains power" tconnors
2933
# /sbin/shutdown -h +0
3034
;;
3135
lowbatt)
36+
# shellcheck disable=SC2145 # I know how fixed_"$@" behaves and it's correct!
3237
echo "Low battery: $@, $NOTIFYTYPE, $UPSNAME" | mail -s "UPS warning low batt, $UPSNAME" tconnors
3338
# echo "We will shut down" | mail -s "upscched-cmd: UPS temporary workaround to shutdown machine on mains power" tconnors
3439
# /sbin/shutdown -h +0
3540
# /usr/sbin/upsmon -c fsd
3641
;;
3742
shutdown)
43+
# shellcheck disable=SC2145 # I know how fixed_"$@" behaves and it's correct!
3844
echo "Shutdown: $@, $NOTIFYTYPE, $UPSNAME" | mail -s "UPS warning shutting down, $UPSNAME" tconnors
3945
# echo "We will shut down" | mail -s "upscched-cmd: UPS temporary workaround to shutdown machine on mains power" tconnors
4046
# /sbin/shutdown -h +0
4147
# /usr/sbin/upsmon -c fsd
4248
;;
4349
replacebatt)
50+
# shellcheck disable=SC2145 # I know how fixed_"$@" behaves and it's correct!
4451
echo "Replace battery: $@, $NOTIFYTYPE, $UPSNAME" | mail -s "UPS warning replace battery, $UPSNAME" tconnors
4552
;;
4653
*)
54+
# shellcheck disable=SC2145 # I know how fixed_"$@" behaves and it's correct!
4755
echo "Unrecognized command: $@, $NOTIFYTYPE, $UPSNAME" | mail -s "UPS warning, $UPSNAME" tconnors
4856
;;
4957
esac

roles/openwrt/files/.bash_profile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- Mode: shell-script -*-
12
# shellcheck shell=bash
23

34
PATH=$PATH:/root/bin

0 commit comments

Comments
 (0)