You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On systems where sh is provided by the dash shell (Ubuntu ships like this) the mons daemon mode is broken due to a bashism in the script:
$ checkbashisms mons.sh
possible bashism in mons.sh line 272 ('$(< foo)' should be '$(cat foo)'):
[ "$(<"$status")" = 'connected' ] && i=$((i+1))
This results in the status file(s) not being read, and hence i always evaluates to 0 each time around the loop. Changes in monitor layout are therefore never detected.
This can be addressed as follows:
diff --git a/mons.sh b/mons.sh
index b86ce5c..f7c5616 100755
--- a/mons.sh
+++ b/mons.sh
@@ -268,8 +268,8 @@ main() {
if $aFlag ; then
prev=0; i=0
while true; do
- for status in /sys/class/drm/*/status; do
- [ "$(<"$status")" = 'connected' ] && i=$((i+1))
+ for output_status in /sys/class/drm/*/status; do
+ [ "$(cat "$output_status")" = 'connected' ] && i=$((i+1))
done
if [ "$i" != "$prev" ]; then
(Note I changed the variable name at the same time since 'status' is a readonly variable in zsh -- while that's not an issue for me it is possible that other people have /bin/sh linked to zsh and they'd then have problems too).
The text was updated successfully, but these errors were encountered:
On systems where sh is provided by the dash shell (Ubuntu ships like this) the mons daemon mode is broken due to a bashism in the script:
This results in the status file(s) not being read, and hence i always evaluates to 0 each time around the loop. Changes in monitor layout are therefore never detected.
This can be addressed as follows:
(Note I changed the variable name at the same time since 'status' is a readonly variable in zsh -- while that's not an issue for me it is possible that other people have /bin/sh linked to zsh and they'd then have problems too).
The text was updated successfully, but these errors were encountered: