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.

-- 

As a proper list etiquette.....
Please trim your replies. Avoid cross posting to other lists.
Members do not want to waste time answering same queries that may have 
been answered on other lists.
Replies from other lists, to cross posted mails are not available to our 
members.
Post your replies below the relevant original text, leaving a line space.
Do not re-use old messages to write new ones. For new messages, create a 
new message.

Regards,

Rony.

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

Reply via email to