Is it possible to increase the maximum number of characters that ksh variable accepts?

后端 未结 1 443
陌清茗
陌清茗 2021-01-19 17:14

This is a follow up question to

What is the maximum number of characters that the ksh variable accepts?

I checked my environment and it\'s allowing only

相关标签:
1条回答
  • 2021-01-19 17:36

    You could compile a Linux 3.7.x kernel, and edit its include/uapi/linux/limits.h file to increase the ARG_MAX argument (to some bigger power of two, e.g. 2097152). But you should rather have a lot of RAM (e.g. 8GBytes) if you want to increase it more.

    The actual limit is related to execve(2). That man page has a paragraph on it.

    But you could probably avoid having huge shell variables (in the Unix environment). Did you consider using some other tool (awk, python, perl ....) to read your file? Their variable environment is not the shell environment transmitted to forked programs, so they can have variables with very long values. Maybe ksh has some builtin (unexport) to avoid exporting some variable into the Unix environment.

    0 讨论(0)
提交回复
热议问题