我发现了一个有趣的“function”
DIR_INPUT = /testing
testing:
#testingdate(应该是昨天)
testing! -z“$ {DATE}”
ls -lad $ {DIR_INPUT} / {a,c}
但它似乎以一种奇怪的方式工作:
提示#进行testing
#testingdate(应该是昨天)
testing! -z“20100120”
ls -lad / test / {a,c}
/ test / {a,c}:没有这样的文件或目录
***错误代码2
make:致命错误:命令对目标`test'失败
提示#
当然,如果我从我的shell工程中发出ls -lad / test / {a,c} 。
问题:我怎么才能做出评估这个模式的shell呢?
你可以使用shell函数$(shell touch {a..c})(也可能是通配符函数)执行此操作:
kbrandt@kbrandt-opadmin:~/scrap/make$ ls foo kbrandt@kbrandt-opadmin:~/scrap/make$ vim foo kbrandt@kbrandt-opadmin:~/scrap/make$ ls foo kbrandt@kbrandt-opadmin:~/scrap/make$ cat foo files: $(shell touch {a..c}) kbrandt@kbrandt-opadmin:~/scrap/make$ make -f foo make: `files' is up to date. kbrandt@kbrandt-opadmin:~/scrap/make$ ls abc foo kbrandt@kbrandt-opadmin:~/scrap/make$