The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 01-10-2006
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,798
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]$