命令 'touch "file{1..10}".txt' 創建 10 個檔案 file1.txt、file2.txt .... 等。我們如何在這種形式中創建多個具有特定檔案大小的檔案。
我嘗試了什么:
fallocate -l 10M file{1..10}.txt
輸出
fallocate: unexpected number of arguments
uj5u.com熱心網友回復:
您可以使用truncate將檔案的大小擴展到特定大小
truncate -s 10M file{1..10}.txt
uj5u.com熱心網友回復:
根據手冊頁,fallocate只需要一個檔案名。
您可以使用回圈:
for f in file{1..10}.txt
do
fallocate -l 10M "$f"
done
或作為單行
for f in file{1..10}.txt; do fallocate -l 10M "$f"; done
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/515335.html
