forrest_hong 发表于 2008-8-28 13:44:34

请教: linux command "cp" 的问题

在我的.mak file里有这样一句

cp -f $(WEBUI_THEME_DIR)/*.html $(WEBUI_THEME_DIR)/*.js $(INSTALL_DIR)/webs

如果这个目录$(WEBUI_THEME_DIR)下面没有*.html 或 *.js, 就会出错, 提示是"no such file or directory".

请问用什么方法可以解决这个问题?
不能用 cp -f $(WEBUI_THEME_DIR)/*.* $(INSTALL_DIR)/webs

谢谢了。

binbindatou 发表于 2008-8-28 22:39:17

参见本版置顶精华:http://www.linuxfans.org/bbs/thread-141414-1-1.html

for file in $(WEBUI_THEME_DIR)/
do
if [ "${file##*.}" = "html" ] or [ "${file##*.}" = "js" ]
then
xxxxxxxxxx
fi
done
或者你用错误重定向,可以禁止错误输出 ls *.html 2> /dev/null
页: [1]
查看完整版本: 请教: linux command "cp" 的问题