Quantcast
Channel: Active questions tagged return-value - Stack Overflow
Viewing all articles
Browse latest Browse all 207

React to return value of a function not working properly

$
0
0

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?


Viewing all articles
Browse latest Browse all 207

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>