/me wrote:
So, two suggestions:
- STDERR from xrandr should go to /dev/null or to a log file/syslog, so -foreach (
DISPLAY=:0 LANG=C xrandr | grep ' connected ' | cut -d ' ' -f1
) +foreach (DISPLAY=:0 LANG=C xrandr 2>/dev/null | grep ' connected ' | cut -d ' ' -f1
)
- A simple fix could be if (1 <
DISPLAY=:0 LANG=C xrandr | grep ' connected ' | wc -l
) { foreach (DISPLAY=:0 LANG=C xrandr | grep ' connected ' | cut -d ' ' -f1
) { ... } } I'm sure there might be a more elegant solution that works within the foreach loop, but "Hanc marginis exiguitas non caperet."
And indeed there is:
-Stefan