pgrep "program" and if statement
Hi, I don't know why this always returns the false boolean:
Code:
if [ ! -z $(pgrep "mediatomb") ] ; then Code:
echo $(pgrep "mediatomb") Ted |
The command substitution is performed before the test take places, so that it actually is something like:
Code:
if [ ! -z 1222 1223 1224 1225 1230 1232 1234 1236 1237 1238 1975 1979 1980 1981 ] ; then Code:
if pgrep bash; then Moreover note that ! -z is the same as -n (the length of string is nonzero). |
Quote:
Thanks for reminding, I realized that double quote should be made: Code:
if [ ! -z "$(pgrep "mediatomb")" ] ; then |
All times are GMT -5. The time now is 11:58 PM. |