mek@enterprise.udev.cdc.com (Mark Kennedy) (09/18/90)
Can anybody tell me what the maximum length for a variable is in the C-shell? In my experience on both Sun workstation and MIPS the limit is a mere 18 characters. While that may seem adequate for most uses, I want to be really verbose! The Borne shell allows me longer variable names. I don't really know the limit for it either. So, is the limit really 18, or is this a bug? Where is the limit documented? Thanks. -Mark Mark Kennedy AT&T: (612) 482-2787 Control Data Corporation E-Mail: mek@udev.cdc.com If you can read this you're in phaser range.
sthomas@garth.UUCP (Steve Thomas) (09/29/90)
In article <25872@shamash.cdc.com> mek@enterprise.udev.cdc.com (Mark Kennedy) writes: >Can anybody tell me what the maximum length for a variable is in the >C-shell? In my experience on both Sun workstation and MIPS the >limit is a mere 18 characters. The answer is, as usual, it depends. (Do I get my guru badge now? 8-) The parse-a-variable code inside the C-shell is inserted in line wherever it's required. As a result, the maximum length permitted (and, come to that, the legal characters in the name of the variable) varies depending on the exact syntax. It's always at least 18, and occasionally 19 or 20. Except for arrays, of course, when it goes up to about 40 some of the time. There is, of course, the possibility that particular vendors may have fixed this farrago and imposed a possibly different and more consistent limit. Portable scripts will use only 18 characters or less. To forestall any queries, a variable name is supposed to be [A-Za-z][A-Za-z0-9]*, though in some places csh permits a digit in the first position and/or forbids digits in the rest. Again, some vendors may have fixed this `feature'. Portable scripts should only use letters in variable names. Steve Thomas