Zren / plasma-applet-commandoutput

https://store.kde.org/p/1166510/
GNU General Public License v2.0
87 stars 18 forks source link

Does not evaluate if conditions #38

Open colutti opened 1 year ago

colutti commented 1 year ago

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.

Zren commented 1 year ago

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.

Sadi58 commented 1 year ago

Actually, it must be OK. 1) I have a more complex one-liner script with if conditions running perfectly. 2) I've tried your code, and it was OK here on Sparky KDE (Debian Testing) 5.26.4.