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
I was currently writing a script for displaying playerctl details in i3bar and wanted to develop a case where the script shouldn't execute, that is when no players are active. My first thought was to use the playerctl status command and match it with "No players found" and it worked, but I wasn't able to suppress the excess output associated with it, that is "No players found". I also checked if playerctl throws an exit code when executing playerctl status in absence of any music players, and it doesn't. It always exits with zero exit code.
Therefore it would be great if the functionality of returning an error code other than 0 were implemented since that would enable me to use the following:
#Exit script if no players running
playerctl status 2>/dev/null ||exit 3;
The text was updated successfully, but these errors were encountered:
I was currently writing a script for displaying
playerctl
details in i3bar and wanted to develop a case where the script shouldn't execute, that is when no players are active. My first thought was to use theplayerctl status
command and match it with"No players found"
and it worked, but I wasn't able to suppress the excess output associated with it, that is"No players found"
. I also checked if playerctl throws an exit code when executingplayerctl status
in absence of any music players, and it doesn't. It always exits with zero exit code.Therefore it would be great if the functionality of returning an error code other than
0
were implemented since that would enable me to use the following:The text was updated successfully, but these errors were encountered: