在学习 bash 的过程中,我经常调整现有的东西并查看它的输出。
~$ for i in {1..19}; do echo "Everything in UNIX is a file."; sleep 1; done
我有这个,出于好奇,我将上述内容调整为以下内容:-
~$ for i in {1..19 * 2}; do echo "Everything in UNIX is a file."; echo "The value of i is ${i}"; sleep 1; done
现在令我惊讶的是,我开始得到以下输出:-
Everything in UNIX is a file.
The value of i is OneDrive
Everything in UNIX is a file.
The value of i is opera autoupdate
Everything in UNIX is a file.
The value of i is Personal_Workspace
Everything in UNIX is a file.
The value of i is Pictures
Everything in UNIX is a file.
The value of i is PrintHood
Everything in UNIX is a file.
The value of i is Recent
Everything in UNIX is a file.
The value of i is Roaming
Everything in UNIX is a file.
The value of i is Saved Games
Everything in UNIX is a file.
The value of i is Searches
i 的一些值是我的主目录中的文件和目录的名称,我在主目录中,同时执行这个脚本。
我期望 i 值的范围是 1 到 19*2 = 38,所以我会取 1,2,3...30...38 的值。但显然它没有为什么?