for var in `find $PWD -type f -name "*.jsp"` do echo $var var_destination=`echo $var | sed -e 's/.jsp/.ftl/'` echo $var_destination sed -e '/<%@.*/d' -e '/.*%>/d' -e '/<jsp:include/{s/jsp:/#/;s/page=//;s/.jsp/.ftl/;s/><\/jsp:include>/\/>/;}'$var > $var_destination grep -n "<c:"$var_destination
if [ $? -eq0 ];then echo -e "\033[0;33;1m注意!!!注意!!! `echo $var_destination` 中有【<c:】标签\033[0m" grep -n "<fmt:"$var_destination if [ $? -eq0 ];then echo -e "\033[0;33;1m注意!!!注意!!! `echo $var_destination` 中有【<fmt:】标签\033[0m" fi else echo -e "\033[0;32;1m`echo $var_destination` 修改完成 \033[0m" grep -n "<fmt:"$var_destination if [ $? -eq0 ];then echo -e "\033[0;33;1m注意!!!注意!!! `echo $var_destination` 中有【<fmt:】标签\033[0m" else echo -e "\033[0;32;1m`echo $var` 修改完成 \033[0m" fi fi done
shell_2 逻辑处理(只能手动)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
for var in `find $PWD -type f -name "*.ftl"` do grep -n "<c:"$var if [ $? -eq0 ];then echo -e "\033[0;33;1m注意!!!注意!!! `echo $var` 中有【<c:】标签\033[0m" grep -n "<fmt:"$var if [ $? -eq0 ];then echo -e "\033[0;33;1m注意!!!注意!!! `echo $var` 中有【<fmt:】标签\033[0m" fi else grep -n "<fmt:"$var if [ $? -eq0 ];then echo -e "\033[0;33;1m注意!!!注意!!! `echo $var` 中有【<fmt:】标签\033[0m" else echo -e "\033[0;32;1m`echo $var` 修改完成 \033[0m" fi fi done