Are shell variables limited in size? And which is the max size a variable can hold?
相关问题
- How to get the return code of a shell script in lu
- Invoking Mirth Connect CLI with Powershell script
- Emacs shell: save commit message
- “command not found” errors in expect script execut
- Python script using subprocess and xclip hangs if
相关文章
- 使用2台跳板机的情况下如何使用scp传文件
- In IntelliJ IDEA, how can I create a key binding t
- shell中反引号 `` 赋值变量问题
- How get the time in milliseconds in FreeBSD?
- Launch interactive SSH bash session from PHP
- Generate disk usage graphs/charts with CLI only to
- How can I create a small IDLE-like Python Shell in
- Pause shell script until user presses enter
Yes they can be. It depends on your OS and/or the shell flavours and versions. It is safer to use temporary files if you expect variable values to exceed 1-4kB.
EDIT
Also see What is the maximum size of an environment variable value?; this deals with the OS limitation on total
environ
size (cumulative size of allVARIABLE=VALUE
s) which affectsexport
ed variables, but the shell itself may have its own limitations re. all (including non-export
ed) variable sizes.This being said, unless you have portability in mind, GNU
bash
is relatively good about not limiting (non-export
ed) variables' sizes and can very likely hold arbitrary amounts of data as long asmalloc
can find sufficient memory and contiguous address space. :)