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 -->
  #3 (permalink)  
Old 01-05-2009
./hari.sh's Avatar
./hari.sh ./hari.sh is offline
Registered User
  
 

Join Date: Jul 2007
Location: India
Posts: 44
there is some other prob...

Let me tell you what exactly I want

I have a word having 8 chrs, something like abc12345 or ab123456

Now, if last five chrs are digits then I wanna do some other operation

I used the code
Code:

if [ `echo $WORD | cut -c 4-8  | grep -oE [[:digit:]] | wc -l` -eq 5 ]
then
do this...
bash command line it gives the output, but in script it gives "0" always"