我有这个Makefile:
VAR=foo(1).txt foo(2).txt
foobar: $VAR
cp -p $^ foo/
当我运行它时,我收到此错误:
$ make test
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `cp -p foo(1).txt foo(2).txt foo/'
Makefile:3: recipe for target 'foobar' failed
make: *** [test] Error 1
如何快速摆脱它?
答案 0 :(得分:1)
您可以用双引号
包装文件名cp "foo(1).txt" "foo(2).txt" /out
<强>测试强>
$ cp "foo(1).txt" "foo(2).txt" out/
$ ls out/
foo(1).txt foo(2).txt
或者更安全
cp 'foo(1).txt' 'foo(2).txt' out/