plasma-applet-commandoutput icon indicating copy to clipboard operation
plasma-applet-commandoutput copied to clipboard

Does not evaluate if conditions

Open colutti opened this issue 3 years ago • 2 comments

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.

colutti avatar Nov 23 '22 15:11 colutti

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.

Zren avatar Nov 24 '22 14:11 Zren

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.

Sadi58 avatar Dec 11 '22 14:12 Sadi58