C-shell maximum variable name length?

C-shell maximum variable name length?

Post by Oort » Wed, 27 Sep 2000 04:00:00



Hello,

I'm wondering is there a bug in the C shell (Solaris 7)? It allows me to set
an environment variable using setenv but does not allow me to view it using
echo:

keats 296: setenv GPS_TIMEBASE_WARNINGS 0
keats 297: echo $GPS_TIMEBASE_WARNINGS
Variable name too long
keats 298:

However an 'env' shows that the variable has been set correctly. I don't see
the same behaviour under HP-UX.

Any ideas?

Thanks,

Patrick

 
 
 

C-shell maximum variable name length?

Post by ottomeis.. » Wed, 27 Sep 2000 04:00:00




Quote:> keats 296: setenv GPS_TIMEBASE_WARNINGS 0
> keats 297: echo $GPS_TIMEBASE_WARNINGS
> Variable name too long

From 'man csh' under "Variable Substitution":

     The C shell maintains a set of variables, each of  which  is
     composed  of a name and a value. A variable name consists of
     up to 20 letters and digits, [...]

At first blush it's a little surprising that csh's 'setenv' will let
you put something into the environment that 'csh' is unwilling to
retrieve as a variable, but that does allow you to put long-named
variables into the environment for interpretation by child processes.
('set', on the other hand, won't let you create too-long shell
variables.  That would be completely pointless.)

The workaround is obvious:

    sh -c 'echo $GPS_TIMEBASE_WARNINGS'

OttoM.
--

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

C-shell maximum variable name length?

Post by Rich Tee » Wed, 27 Sep 2000 04:00:00



> Any ideas?

Don't use csh for scripting!

--
Rich Teer

NT tries to do almost everything UNIX does, but fails - miserably.

The use of Windoze cripples the mind; its use should, therefore, be
regarded as a criminal offence.  (With apologies to Edsger W. Dijkstra)

Voice: +1 (250) 979-1638
URL: http://www.rite-online.net

 
 
 

1. Long ( +20) variable names in C-shell

Hi all,

I have the next problem: I'm bound to the C-shell for interactive usage.
on 2 systems: SunOS 4.1.3 and HP-UX 9.05, no problem so far.

HP comes with VUE as their implementation of X11 and we like to use it
on the HP stations.

VUE requires the setting of the next environment variables:
VPMUSERFILESEARCHPATH, VUEACTIONSEARCHPATH, and others of this horible size.

In the C-shell I can set them but I cannot use them in constructions like
setenv VPMUSERFILESEARCHPATH /new/path:${VPMUSERFILESEARCHPATH}

7% setenv ABCDEFGHIJKLMNOPQRSTUVWXYZ alphabeth
8% echo $ABCDEFGHIJKLMNOPQRSTUVWXYZ
Variable syntax.
9% echo ${ABCDEFGHIJKLMNOPQRSTUVWXYZ}
ABCDEFGHIJKLMNOPQR: Undefined variable.
10% setenv ABCDEFGHIJKLMNOPQRSTUVWXYZ long_$ABCDEFGHIJKLMNOPQRSTUVWXYZ
Variable syntax.
11% setenv ABCDEFGHIJKLMNOPQRSTUVWXYZ long_${ABCDEFGHIJKLMNOPQRSTUVWXYZ}
ABCDEFGHIJKLMNOPQR: Undefined variable.
12% env | grep ABCDEF
ABCDEFGHIJKLMNOPQRSTUVWXYZ=alphabeth
13%

The above indicates that I can set the variable with the long name
but I cannot use it.

Does someone have a solution?
Changing shell is no solution, it is the only shell available on all
the systems we are using and therefore the default for all users.

Groetjes
Corne
--
This is MY opinion, not the opinion of my boss nor the company!
C.J.P. Beerse                           | Alcatel Telecom Systems

Tel:(+31)70 3079108 Fax:(+31)70 3079191 | NL-2280 GG  Rijswijk

2. Cheyenne ArcServe Agent for Linux

3. Maximum length of the environment variable's content

4. Cpuinfo flags

5. Maximum Length of Environment Variables?

6. How use GCC and other GNU program under Solaris.

7. Maximum length of a group's name ?

8. ftp: no HOME-dir

9. Maximum length of shell command?

10. assign variables a result from a command in c-shell

11. C-SHELL BUG - @ variable = 'expression' - LONG.

12. Variable problem in c-shell

13. C-shell script variable substitution problem/question