让文件=" apartment.flat my apartment1.flat"
我想使用cat $ files
捕获这些文件问题是cat搜索apartment.flat,my和apartmrnt1.flat
为了逃避这些空间,我需要做些什么?
我尝试过文件=" apartment.flat' my apartment1.flat'" 和files =" apartment.flat my \ apartment1.flat" 什么都行不通......
感谢!
答案 0 :(得分:3)
您应该使用数组:
files=(apartment.flat "my apartment1.flat")
cat "${files[@]}"
答案 1 :(得分:-2)
你只需要将$文件放在引号内,应该帮助你
files =" apartment.flat my apartment1.flat"
cat" $ files"
这对我有用
$ files="apartment.flat my apartment1.flat"
$ echo $files
apartment.flat my apartment1.flat
$ cat "$files"
hi how are you..