On Fri, Mar 25, 2011 at 11:56:51PM +0530, Rony wrote:
> On Friday 25 March 2011 05:56 PM, Binand Sethumadhavan wrote:
> > 2011/3/25 Rony Bill<[email protected]>:
> >> if
> >> grep -q "$USER" present
> >> then
> >> echo "Sorry! You have already logged in today."
> > I have several comments on style and other issues, but this snippet is
> > plain buggy. Imagine two users, prabhakaran and karan. If the former
> > has marked his attendance, this code will not allow the latter to do
> > so at all.
> >
> >
> I created a test script like the above
> 
> #!/bin/bash
> 
> echo -n "Please enter your name: "
> read -e USER
> if grep -q "$USER" namelist
> then echo $USER
> else
> echo "Name does not exist"
> fi
> 
> In namelist file I added Rony, Macrony and karan.
> 
> While both rony and Rony are accepted, for the other 2 names they are 
> even case sensitive and do not accept macrony or Karan. Even prabhakaran 
> and karunakaran are rejected. Why rony is not case sensitive is still a 
> mystery.

I've heard that awk is very good at these text things. Ever gave it a try?
I don't know much about it, just giving a hint.

Btw, there is this string of tutorials on awk at bashshell.net starting
with:
http://bashshell.net/stream-filtering-utilities/exercise-1-learning-awk-basics/


-- 
Regards,
Nitesh Mistry | www.mistrynitesh.com
PGP key id: A6FEF696 | 'geekosopher' on freenode irc

Attachment: pgpZx29j9OpMU.pgp
Description: PGP signature

-- 
http://mm.glug-bom.org/mailman/listinfo/linuxers

Reply via email to