英文:
what is the rule file matching of command `rm` in makefile?
问题
I was required to run a makefile on mint, I input the option 'clean' about:
clean:
I type this order in shells rm -f test_{a,b}.o
, and it do delete the file test_a.o
and test_b.o
, but it doesn't work on Mint OS, but it work on CentOS7.
I want to find the reason for this problem. now I use rm -f test_a.o test_b.o
instead temporarily.
英文:
I was required to run a makefile on mint, I input the option 'clean' about:
clean:
<tab> rm -f test_{a,b}.o
I type this order in shells rm -f test_{a,b}.o
, and it do delete the file test_a.o
and test_b.o
, but it doesn't work on Mint OS, but it work on CentOS7.
I want to find the reason for this problem. now I use rm -f test_a.o test_b.o
instead temporarily.
答案1
得分: 1
这取决于shell:大括号扩展在Bash中受支持,但例如在dash中不受支持,dash是Ubuntu上的默认/bin/sh
shell;而/bin/sh
是Makefile中的默认shell。您可以通过以下方式在Makefile 中切换所使用的shell:
SHELL = /bin/bash
英文:
This depends on the shell: brace expansion is supported by Bash, but for example not by dash, which is the default /bin/sh
shell on Ubuntu; and /bin/sh
is the default shell in Makefiles. You could switch the shell used in the Makefile with
SHELL = /bin/bash
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论