继续我与争论和空间的斗争,考虑另外3个目录 目录和脚本:
Folder One
Folder Two
Folder Three
script
脚本如下:
#!/bin/bash
for i in $@
do
echo $i
done
运行时:
./script *
我得到了这个输出:
Folder
One
Folder
Two
Folder
Three
script
是否有某种方法可以获得此输出:
Folder One
Folder Two
Folder Three
script
换句话说,不要在空格上分割$@
参数?
答案 0 :(得分:5)
试试这个:
#!/bin/bash
for i in "$@"
do
echo $i
done