Seseorang dapat menggunakan installperintah dengan -Dflag.
bash-4.3$ install -D /dev/null mydir/one/two
bash-4.3$ tree mydir
mydir
└── one
└── two
1 directory, 1 file
bash-4.3$
Jika kami memiliki banyak file, kami mungkin ingin mempertimbangkan untuk menggunakan daftar item (perhatikan, ingatlah untuk mengutip item dengan spasi), dan beralihlah ke item tersebut:
bash-4.3$ for i in mydir/{'subdir one'/{file1,file2},'subdir 2'/{file3,file4}} ; do
> install -D /dev/null "$i"
> done
bash-4.3$ tree mydir
mydir
├── one
│ └── two
├── subdir 2
│ ├── file3
│ └── file4
└── subdir one
├── file1
└── file2
Atau sebagai alternatif dengan array:
bash-4.3$ arr=( mydir/{'subdir one'/{file1,file2},'subdir 2'/{file3,file4}} )
bash-4.3$ for i in "${arr[@]}"; do install -D /dev/null "$i"; done
bash-4.3$ tree mydir
mydir
├── one
│ └── two
├── subdir 2
│ ├── file3
│ └── file4
└── subdir one
├── file1
└── file2
touchperintah asli dan menambahkan pergantian-pke sana?