I'd like to react to return value of a function, but my code is not working properly:
#!/bin/bashclearecho $(sudo pacman -Rcs "$(pacman -Qdtq)")if [[ $(sudo pacman -Rcs "$(pacman -Qdtq)") == "Error:"* ]]; then echo -e "Nothing found." exitelse echo -e "still running ..." sudo pacman -Rcs "$(pacman -Qdtq)" echo $?fi
The code returns:
Error: nothing found: Error: nothing found: still running ...Error: nothing found: 1
How to make the if condition work properly?