in reply to Curious about a quirk with the special variable, $0
a) What is the actual purpose of the special scalar variable, $0, which holds the filename of the script
You've answered your own question. Its purpose is to provide the file name of the script.
b) Did I not get a warning about the undeclared variable
The variable has a value, which means it exists, which means it has been defined, which means it has been declared. Just not by you.
c) Did the count iterate to 1..9 because the special scalar variable, $0, was treated as zero due to the numeric lt (<) operator?
The value in $0 (the script's file name) was treated as zero because the numerical value of a string that doesn't look like a number is zero. "56" + "4" + "abc" is equal to 60 (although you'll get a warning if they're on as they should be).
|
|---|