a)将命令行参数作为:
./myscript.sh <path> dir1 dir2 dir5 dir2/dir5 dir5/dir7
并在
中创建目录<path>/dir1 <path>/dir2 <path>/dir5 <path>/dir2/dir5 <path>/dir5/dir7
答案 0 :(得分:1)
#!/bin/bash
for i in "$@"; do
mkdir -p -- "$i"
done
或
#!/bin/bash
mkdir -p -- "$@"