-
Notifications
You must be signed in to change notification settings - Fork 148
Add shellcheck support and some fixes to make shell scripts "cleaner" #1074
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
name: Shellcheck | ||
|
||
on: | ||
push: | ||
branches: [release] | ||
pull_request: | ||
branches: [release] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
shellcheck: | ||
name: Check shell scripts | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Install dependencies | ||
run: | | ||
sudo apt update && sudo apt install -y shellcheck | ||
- name: shellcheck | ||
run: | | ||
git grep -l '^#\( *shellcheck \|!\(/bin/\|/usr/bin/env \)\(sh\|bash\|dash\|ksh\)\)' | xargs shellcheck | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,10 +19,10 @@ export XDG_CONFIG_HOME=$HOME/paperwm/.config | |
args=() | ||
|
||
DISPLAY=$NEW_DISPLAY | ||
eval $(dbus-launch --exit-with-session --sh-syntax) | ||
echo $DBUS_SESSION_BUS_ADDRESS | ||
eval "$(dbus-launch --exit-with-session --sh-syntax)" | ||
echo "$DBUS_SESSION_BUS_ADDRESS" | ||
|
||
echo -n $DBUS_SESSION_BUS_ADDRESS \ | ||
echo -n "$DBUS_SESSION_BUS_ADDRESS" \ | ||
| DISPLAY=$old_display xclip -i -selection clipboard | ||
|
||
DISPLAY=$old_display | ||
|
@@ -35,13 +35,13 @@ case $1 in | |
echo "Running X11 Gnome Shell" | ||
Xephyr $NEW_DISPLAY & | ||
DISPLAY=$NEW_DISPLAY | ||
args=--x11 | ||
args=(--x11) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We're not really using the array, so I think we might as well make this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. well, then better be named also |
||
;; | ||
esac | ||
|
||
|
||
dconf reset -f / # Reset settings | ||
dconf write /org/gnome/shell/enabled-extensions "['paperwm@paperwm.github.com']" | ||
|
||
gnome-shell $args | ||
gnome-shell "${args[@]}" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does
*shellcheck
do?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://www.shellcheck.net/ says in the title "finds bugs in your shell scripts." ;)
Quite often it is so, and most often could be observed if you run any script under path with a space in some folder name . (that is why in our datalad tool testing we even come up with some most obscure path filesystem can tollerate to ensure we always correctly quote etc)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I should have clarified. I know shellcheck (it's great, I use it for all my shell scripts). I was asking about the string "
*shellcheck
" in thegit grep
regex.