View Single Post
Old 07-01-2012, 09:34 AM   #38
silver18
THE NOOB
silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.silver18 ought to be getting tired of karma fortunes by now.
 
silver18's Avatar
 
Posts: 701
Karma: 1545649
Join Date: Jan 2012
Location: Italy
Device: Kindle Touch 5.3.2
Quote:
Originally Posted by baf View Post
Statuses are returned correctly on my K5:
Code:
[root@kindle test]# image="hello"; echo "$image" | grep -q "x"; echo $?
1
[root@kindle test]# image="hello"; echo "$image" | grep -q "h"; echo $?
0
I see...it works that way...

But, using this (to check for spaces in variable image):
Code:
echo "$image" | grep -q " "
if [[ $? -eq 0 ]]
then
the if is always executed.

I managed to solve using this:
Code:
check=$(echo "$image" | grep " ")
if [[ -n "$check" ]]
then
silver18 is offline   Reply With Quote