plasma-applet-commandoutput
plasma-applet-commandoutput copied to clipboard
Does not evaluate if conditions
I am trying to display a text when a process is running or not, so I added this line to the plasmoid command:
if pgrep -af 'My Process' &>/dev/null; then echo "Running"; else echo "Not running"; fi
The line above works fine on bash and zsh, but when running it with the plasmoid it never evaluates to false, so it never pronts "Not running" when the process is not running.
That's because you're running a single command/process, not a bash script. If you want a bash script, you need to run the bash command with the script as an argument.
Actually, it must be OK.
- I have a more complex one-liner script with if conditions running perfectly.
- I've tried your code, and it was OK here on Sparky KDE (Debian Testing) 5.26.4.