The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

i'm gonna kick myself by nimdokk2002-06-20 15:30:24
  further info by nimdokk2002-06-20 15:42:57
    ok by nimdokk2002-06-20 16:06:46
      I've experienced this before by Kickstart2002-06-20 16:58:10
        It has to dowith the use of <>, not the loop. by inittab 2002-06-20 22:43:50
Note: if you pass SEVERAL file names to your script, like:

$ script.pl file1 file2 file3

Then the script will read through ALL of them, in sequence,
almost as if they were all one long concatinated file.
The <> token pulls a line of input from the current file.
In the process, it gets rid of $ARGV[0], and shifts the
other filenames to the left, so they can be used next.
The input from each file is processed, and the name is
discarded.  So, when you saved $ARGV[0] to another variable
before the loop, it was still around to be printed later.


BTW, the variable $1, in shell scripting is not safe from 
change either...  The command word "shift" will do the same
sort of thing - discarding $1, and moving $2... in its place.
Also, if you say "$set apple pear orange plum" then all of
the $1 .. $n arguments will be discarded, and replaced, with
$1=apple $2=pear $3=orange $4=plum  (Is nothing sacred ?!?!?)
[ Reply ]
          well by nimdokk2002-06-20 23:23:39

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)