![如何使用 mkdir 创建目录以及使用 touch 创建文件来创建目录结构?](https://linux22.com/image/1171600/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%20mkdir%20%E5%88%9B%E5%BB%BA%E7%9B%AE%E5%BD%95%E4%BB%A5%E5%8F%8A%E4%BD%BF%E7%94%A8%20touch%20%E5%88%9B%E5%BB%BA%E6%96%87%E4%BB%B6%E6%9D%A5%E5%88%9B%E5%BB%BA%E7%9B%AE%E5%BD%95%E7%BB%93%E6%9E%84%EF%BC%9F.png)
我写的命令:
mkdir -p mydir/{ colors/{basic/{red,blue,green},blended/{yellow,orange,pink}},shape/{circle,square,cube},animals/{mammals/{platypus,bat,dog},reptiles/{snakes,crocodile,lizard}}}
touch mydir/{colors,shape,animals}
输出:
common_script.sh directory.sh
mydir vpl_environment.sh vpl_execution
./mydir:
animals colors shape
./mydir/animals:
mammals reptiles
./mydir/animals/mammals:
bat dog platypus
./mydir/animals/mammals/bat:
./mydir/animals/mammals/dog:
./mydir/animals/mammals/platypus:
./mydir/animals/reptiles:
crocodile lizard snakes
./mydir/animals/reptiles/crocodile:
./mydir/animals/reptiles/lizard:
./mydir/animals/reptiles/snakes:
./mydir/colors:
basic blended
./mydir/colors/basic:
blue green red
./mydir/colors/basic/blue:
./mydir/colors/basic/green:
./mydir/colors/basic/red:
./mydir/colors/blended:
orange pink yellow
./mydir/colors/blended/orange:
./mydir/colors/blended/pink:
./mydir/colors/blended/yellow:
./mydir/shape:
circle cube square
./mydir/shape/circle:
./mydir/shape/cube:
./mydir/shape/square:
为什么我会得到像这样的额外输出行:
./mydir/animals/mammals/bat:
./mydir/animals/mammals/dog:
./mydir/animals/mammals/platypus:
./mydir/animals/reptiles/crocodile:
./mydir/animals/reptiles/lizard:
./mydir/animals/reptiles/snakes:
./mydir/colors/basic/blue:
./mydir/colors/basic/green:
./mydir/colors/basic/red:
./mydir/colors/blended/orange:
./mydir/colors/blended/pink:
./mydir/colors/blended/yellow:
./mydir/shape/circle:
./mydir/shape/cube:
./mydir/shape/square: