文件名在变量中包含空格和通配符

Oli*_*ult 5 bash space file wildcard

我收到名称包含空格且每周都会更改的文件(名称包含周数)

IE,本周的文件看起来像This is the file - w37.csv

我必须编写一个脚本来考虑该文件。我没有成功编写这个脚本。

如果我做 :

    $FILE="This is the file - w*.csv"
Run Code Online (Sandbox Code Playgroud)

我没有找到/dir/${FILE}

我试过"This\ is\ the\ file - w*.csv"

我尝试/dir/"${FILE}"过并且"/dir/${FILE}"

但我仍然找不到我的文件

看起来名称中的空格需要将变量用双引号引起来,但是不会分析通配符。

您有想法(或答案)吗?

问候,

奥利维尔

Mic*_*ker 5

echo /dir/"This is the file - w"*.csv\n
Run Code Online (Sandbox Code Playgroud)\n\n

或 \xe2\x80\x94\xc2\xa0you 几乎尝试过 \xe2\x80\x94

\n\n
echo /dir/This\\ is\\ the\\ file\\ -\\ w*.csv\n
Run Code Online (Sandbox Code Playgroud)\n