Skip to content

Commit b311127

Browse files
committed
fix some shellcheck warnings
1 parent 78081a2 commit b311127

File tree

6 files changed

+17
-7
lines changed

6 files changed

+17
-7
lines changed

configs/shell/bashrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ _set_ps1() {
107107
VIRTUAL_ENV_NAME=$(basename "$VIRTUAL_ENV")
108108
fi
109109
if [ "$VIRTUAL_ENV_NAME" = '.venv' ]; then
110-
VIRTUAL_ENV_NAME=$(basename $(basename "$VIRTUAL_ENV"))
110+
VIRTUAL_ENV_NAME=$(basename "$(basename "$VIRTUAL_ENV")")
111111
fi
112112
PS1+=" \[\033[0;34m\]$VIRTUAL_ENV_NAME\[\033[00m\]"
113113
fi

configs/x11/xautolock

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
if command -v killall >/dev/null 2>&1; then
44
killall xautolock
55
elif pidof xautolock >/dev/null; then
6-
kill $(pidof xautolock)
6+
kill "$(pidof xautolock)"
77
fi
88

99
if acpi -b 2> /dev/null | grep -q Battery; then

configs/x11/xinitrc

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ exec >> "$HOME/.xlog" 2>&1
88
# unlike other uses of xhost, this is safe since the kernel can check
99
# the actual owner of the calling process.
1010
if command -v xhost >/dev/null 2>&1; then
11-
xhost +si:localuser:$(id -un) || :
11+
xhost "+si:localuser:$(id -un)" || :
1212
fi
1313

1414
# if no argument was passed, try and guess what command to start x with
@@ -24,7 +24,7 @@ if [ -z "$*" ]; then
2424
exit 1
2525
fi
2626
else
27-
X_START_CMD="$@"
27+
X_START_CMD="$*"
2828
fi
2929

3030
# use dbus-launch to spawn the session if available. this enables X applications
@@ -41,7 +41,7 @@ fi
4141
# TODO: find alternative solutions
4242
if command -v 'ssh-agent' >/dev/null 2>&1; then
4343
killall ssh-agent --user $USER
44-
eval $(ssh-agent -s)
44+
eval "$(ssh-agent -s)"
4545
fi
4646

4747
# configure external monitors

scripts/notes.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ main() {
4242
shift
4343
done
4444

45-
eval note_$func $@
45+
eval "note_$func" "$@"
4646
}
4747

4848
note_new() {

scripts/stream-twitch.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ VIDEO_BITRATE_MAX="3600k"
3232
# twitch server in frankfurt, see http://bashtech.net/twitch/ingest.php for list
3333
SERVER="live-ams"
3434

35-
ffmpeg -f x11grab -s $CAPTURE_RESOLUTION -r $FPS -i :0.0 -ar $AUDIO_RATE
35+
ffmpeg -f x11grab -s $CAPTURE_RESOLUTION -r $FPS -i :0.0 -ar $AUDIO_RATE \
3636
-f alsa -i hw:1,0 -f flv -ac 2 -vcodec libx264 -g $GOP -keyint_min $FPS \
3737
-b:v $VIDEO_BITRATE_MAX -minrate $VIDEO_BITRATE_MIN -maxrate $VIDEO_BITRATE_MAX \
3838
-pix_fmt yuv420p -s $OUTPUT_RESOLUTION -preset $PRESET -tune film \

shellcheck.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
3+
: ${SEVERITY:=warning}
4+
5+
# we want to find scripts with a shell-like shebang
6+
# AND files with the .sh extension
7+
{
8+
find ./configs ./scripts -type f -exec awk 'FNR == 1 && /^#!.*sh/{print FILENAME}' {} +
9+
find ./configs ./scripts -type f -name '*.sh'
10+
} | sort | uniq | xargs -r shellcheck --shell=bash --severity "$SEVERITY"

0 commit comments

Comments
 (0)