2019-05-13
第三十一天.png
错误提示
(1)argument last too long
参数列表太长
模拟环境1
创建大量文件
mkdir test
touch test/{1..4000000}.txt
报错
argument last too long
原因
参数列表太长
解决
echo test/{1..4000000}.txt|xargs touch
改变创建大量文件方式
模拟环境2
删除大量文件
ls test/* |xargs rm
报错
argument list too long
原因
参数列表太长
解决
find test/ -type f |xargs rm -fr
环境模拟
(2)cannot allocate memory
无法分配内存
模拟环境1
[echo {1..500000000}.txt
模拟环境2
touch {1..500000000}.txt
环境试验
[root 19:25 @ GYJ ~]# echo {1..500000000}.txt
-bash: xmalloc: cannot allocate 4000000008 bytes (1216512 bytes allocated)
Connection closed by foreign host.
Disconnected from remote host(遇见) at 19:25:26.
Type `help' to learn how to use Xshell prompt.
[c:\~]$
[root 19:27 @ GYJ ~]# touch {1..500000000}.txt
-bash: xmalloc: cannot allocate 4000000008 bytes (1216512 bytes allocated)
Connection closed by foreign host.
Disconnected from remote host(遇见) at 19:28:57.
Type `help' to learn how to use Xshell prompt.
[c:\~]$
直接卡出去
网友评论