filename contains space and wildcard in a variable

前端 未结 3 1042
难免孤独
难免孤独 2021-01-07 11:35

I receive files which names contain spaces and change every week (the name contains the week number)

IE, the file for this week looks like This is the file - w

3条回答
  •  Happy的楠姐
    2021-01-07 11:51

    First of all, you should not use the dollar sign in an assignment.

    Moreover, wildcard expansion is not called in an assignment. You can use process substitution for example, though:

    FILE=$(echo 'This is the file - w'*.csv)
    

    Note that the wildcard itself is not included in the quotes. Quotes prevent wildcard expansion.

提交回复
热议问题