[comp.sys.hp] c-shell variables

pearmana@prlhp1.prl.philips.co.uk (Andy Pearman) (02/20/90)

Hi,

When I run the following c-shell program:

#!/bin/csh
foreach digit1 ( 0 1 2 3 4 5 6 7 8 9 )
     echo $digit1
end


I get the error message :

       foreach: Invalid variable.


We are running HP-UX 6.21 and c-shell variables are permitted to consist
of digits.

Is this a bug with foreach and if so is it fixed in 6.5 or 7.0  ?

     Andy

-- 

Andy Pearman, Computer Dept, Philips Research Labs, Redhill, Surrey, England. 
              pearmana@prl.philips.co.uk

jthomas@nmsu.edu (James Thomas) (02/23/90)

In article <1052@prlhp1.prl.philips.co.uk> pearmana@prlhp1.prl.philips.co.uk (Andy Pearman) writes:

andy> When I run the following c-shell program:

andy> #!/bin/csh
andy> foreach digit1 ( 0 1 2 3 4 5 6 7 8 9 )
andy>      echo $digit1
andy> end

andy> I get the error message :

andy>        foreach: Invalid variable.

The error message is caused by the variable name "digit1".  The same error
message is produced by Sun's version of csh.  "i1" fails as well.  So, in
spite of the manual claiming that variable names consist of letters,
digits, and underscores, it does not seem they can end with a digit.  Seems
like a bug to me.

decot@hpisod2.HP.COM (Dave Decot) (02/23/90)

> foreach digit1 ( 0 1 2 3 4 5 6 7 8 9 )
> 
> I get the error message: foreach: Invalid variable.
> 
> We are running HP-UX 6.21 and c-shell variables are permitted to consist
> of digits.
> 
> Is this a bug with foreach and if so is it fixed in 6.5 or 7.0  ?

Yes, it is a bug (it has been reported before), and no, it is not fixed
in either of those releases.

This bug is also present in System VR2's C-shells (don't know about VR3
or VR4), and it still appears in 4.3BSD's C-shell.

Dave Decot