如何使用 mkdir 创建目录以及使用 touch 创建文件来创建目录结构?

如何使用 mkdir 创建目录以及使用 touch 创建文件来创建目录结构?

目录树

我写的命令:

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:

相关内容