Hi,

Noticed this today :

<script>
open(FD,'sudo grep -h "Connect time" /var/log/message* | grep -v COMMAND |')  or die 
$! ;
# Do some stuff ...
while ( <FD> ) {
# do more stuff
}
</script>

In the above script (an attempt to check my ppp usage), the script
actually runs 'sudo' only when reading from the file (line #3) and not
when open() is run (line #1).

Why is that ? I am new to programming, so I don't know how other
languages would do this, but it seems counter-intuitive to me. I
presumed 'sudo' would be run when open() is run.

pv.

ps. Is it inadvisable to open the said file like this (see the script
above) ? If so, why ?

-- 
Prahlad Vaidyanathan <[EMAIL PROTECTED]>

I love ROCK 'N ROLL!  I memorized the all WORDS to "WIPE-OUT" in
1965!!

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to