Closed. This question needs to be more focused。它当前不接受答案。
                            
                        
                    
                
                            
                                
                
                        
                            
                        
                    
                        
                            想改善这个问题吗?更新问题,使其仅通过editing this post专注于一个问题。
                        
                        5年前关闭。
                                                                                            
                
        
a)将命令行参数设为:

./myscript.sh <path> dir1 dir2 dir5 dir2/dir5 dir5/dir7


并在其中创建目录

<path>/dir1 <path>/dir2 <path>/dir5 <path>/dir2/dir5 <path>/dir5/dir7

最佳答案

#!/bin/bash
for i in "$@"; do
    mkdir -p -- "$i"
done


要么

#!/bin/bash
mkdir -p -- "$@"

关于linux - 使用命令行参数创建目录的Shell脚本,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/25234418/

10-13 05:10