ls -l ${1}/${2}/${i}*| awk '{ print $5 " " $6 " " $7 " " $8 " " $9}' | ( while read Taille Mois Jour HeureOuAnnee Fichier
do
DateFichierEntreHierAujourdhui $Mois $Jour $HeureOuAnnee
if [ $? -eq 0 ]
then
NbFicREcu_links=`expr ${NbFicREcu_links} + 1`
fi
done
if [ $NbFicREcu_links -eq 0 ]
then
echo 'i am here 1'
echo ${i}
INT14_KO_FR=1
else
echo 'i am here 2'
fi
)
fi
echo "1- in the end of the fonction INT14_KO_FR=${INT14_KO_FR}"
这段代码检测是否缺少特定文件。实际上,当我们进入打印“我在这里1”的块时,我想执行INT14_KO_FR = 1。但是,当我退出此循环时,INT14_KO_FR始终为0(初始值)。该代码两次输入“我在这里1”。真的很奇怪,谢谢大家的帮助
管道在子外壳中运行,因此管道中设置的任何变量都不在外部代码的范围内。根据您熟悉的语言功能以及是否需要与POSIX兼容,此处提到了不同的解决方法。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句