+ -
当前位置:首页 → 问答吧 → bash shell 中变量中储存的内容长度!!!

bash shell 中变量中储存的内容长度!!!

时间:2011-02-07

来源:互联网

bash shell 中变量中储存的内容长度有限制吗?
如果有限制是多少?
这个限制能够修改吗?

请大侠们指点一二。
谢谢。

作者: sunguangshou   发布时间: 2011-02-07

回复 sunguangshou


http://bbs.chinaunix.net/viewthread.php?tid=1750482

作者: ywlscpl   发布时间: 2011-02-07



QUOTE:
bash shell 中变量中储存的内容长度有限制吗?
如果有限制是多少?
这个限制能够修改吗?

请大侠们指点 ...
sunguangshou 发表于 2011-02-07 10:11



基本上是沒有限制....
a=`perl -e "print 1x10000000"`;echo $a   


但shell參數及某些工具(utility)本身有一些問題(bug)...
http://tldp.org/LDP/abs/html/othertypesv.html



QUOTE:
...
The space allotted to the environment is limited. Creating too many environmental variables or ones that use up excessive space may cause problems.
bash$ eval "`seq 10000 | sed -e 's/.*/export var&=ZZZZZZZZZZZZZZ/'`"
bash$ du
bash: /usr/bin/du: Argument list too long
      
Note: this "error" has been fixed, as of kernel version 2.6.23.
...

作者: jason680   发布时间: 2011-02-07

热门下载

更多