[SUMMARY] Limit on what a ksh or posix sh variable can hold.

From: Ian Mortimer <ian_at_physics.uq.edu.au>
Date: Wed, 07 Jul 1999 08:54:26 +1000

The original question was:

> I've struck a problem with a script that has a line like this:
>
> filelist=`cat -`
>
> In the ksh and posix sh this spits the dummy when the file list
> reaches about 352 Kbytes with the message "no space".
> The bourne sh doesn't seem to have any limit on what a variable
> can hold.
>
> Does anyone know where and how this limit is defined.
> Can it be changed?

Thanks to Frank Wortner and Serguei Patchkovskii for their replies.

Frank said:

> I *think* the limits you are running into happen to be artifacts of the
> implementation of the various shells. In other words, the limits are
> "accidents," and I doubt there's any effective way to increase them.

Frank also suggested using perl and Serguei suggested restructuring
the script to avoid that construct. However the script causing the
trouble is the find-requires script for OSF1 that comes with rpm.

Writing it in perl is not a good idea because then perl would become
a prerequisite for rpm. That would make it impossible to build a
perl package on a system without perl installed.

Restructuring the script along the lines suggested by Serguei might
be possible but the simplest solution in this case is to use the
bourne sh.

I've done some more experiments and found that on HP-UX ksh and the
posix sh don't have these limits (or at least have much higher limits).
The public domain ksh on Linux doesn't have this problem either and nor
does bash on Linux or Tru64.

  
Ian

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/ Ian Mortimer _/
_/ ian_at_physics.uq.edu.au ,-_|\ Department of Physics _/
_/ Tel: +61 7 3365 3436 / *\ University of Queensland _/
_/ Fax: +61 7 3365 1242 \_,-._/ St. Lucia, Brisbane _/
_/ v Queensland, Australia 4072 _/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Disclaimer: Speaking only for myself.
Received on Tue Jul 06 1999 - 22:56:35 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:39 NZDT