我熟悉的结构
for file in foo/folder\ with\ spaces/foo2/*.txt
do
#do some stuff...
done
但是,我想放入foo/folder with spaces/foo2/*.txt
一个变量然后使用它。像这样的东西:
myDirectory="foo/folder with spaces/foo2/*.txt"
for file in $myDirectory
do
# do some stuff
done
但是我这里写的不行,就算我写了也行不通
myDirectory="food/folder\ with\ spaces/foo2/*.txt"
或者
for file in "$myDirectory" ...
有什么帮助吗?这甚至可能吗?