Quote:
|
Originally Posted by manthasirisha
i didnt get what is the significance of /dev/null there in the code?
|
Grep, in its simplest form, has this habit of shouting out loud, about the things it discovered. And if it did find, then the exit status is 0. Else 1.
In the OP's case, he wants only detect the presence of a letter in a string. So whatever grep outputs, be it success or failure, discard it.
Here is a non-grep solution as well
Code:
[~/temp]$ echo $LANG
en_US.UTF-8
[~/temp]$ [[ "$LANG" == *US* ]] && echo "US LANG" || echo "LOCALE"
US LANG
[~/temp]$