当前位置: 技术问答>linux和unix
shell 的一个语法错误
来源: 互联网 发布时间:2016-12-22
本文导语: while read Inode Flags Age Date Size Filename do echo $Inode $Flags $Age $Date $Size $Filename if [$Flags -eq "FN.." ] and [$Age -eq "100%" ] ; then #exec ntfsundelete /dev/sdb7 -u -i $Inode -o $Inode -d /home/fuxiang & fi done read2.sh: line ...
while read Inode Flags Age Date Size Filename
do
echo $Inode $Flags $Age $Date $Size $Filename
if [$Flags -eq "FN.." ] and [$Age -eq "100%" ] ; then
#exec ntfsundelete /dev/sdb7 -u -i $Inode -o $Inode -d /home/fuxiang &
fi
done
read2.sh: line 13: 在未预料的“fi”附近出现语法错误
read2.sh: line 13: ` fi'
菜鸟 望指出
我准备读取一个文件中的内容
Inode Flags %age Date Size Filename
---------------------------------------------------------------
675 FN.. 100% 2011-06-27 3072 Thumbs.db
680 FN.. 39% 2011-06-27 173816842 变形金刚.mkv
726 FN.. 0% 2011-06-27 52946 1.jpg
727 FN.. 0% 2011-06-27 496881 2.jpg
782 FN.. 90% 2011-06-27 43315 免费最新BT电影双击进入..url
|
文件内容
#cat csdn_test
Inode Flags %age Date Size Filename
---------------------------------------------------------------
675 FN.. 100% 2011-06-27 3072 Thumbs.db
680 FN.. 39% 2011-06-27 173816842 变形金刚.mkv
726 FN.. 0% 2011-06-27 52946 1.jpg
727 FN.. 0% 2011-06-27 496881 2.jpg
782 FN.. 90% 2011-06-27 43315 免费最新BT电影双击进入..url
脚本内容
#cat csdn_test.sh
while read Inode Flags Age Date Size Filename
do
echo $Inode $Flags $Age $Date $Size $Filename
if [[ $Flags = "FN.." && $Age = "100%" ]]
then
#exec ntfsundelete /dev/sdb7 -u -i $Inode -o $Inode -d /home/fuxiang &
echo $Inode
fi
done
#cat csdn_test
Inode Flags %age Date Size Filename
---------------------------------------------------------------
675 FN.. 100% 2011-06-27 3072 Thumbs.db
680 FN.. 39% 2011-06-27 173816842 变形金刚.mkv
726 FN.. 0% 2011-06-27 52946 1.jpg
727 FN.. 0% 2011-06-27 496881 2.jpg
782 FN.. 90% 2011-06-27 43315 免费最新BT电影双击进入..url
脚本内容
#cat csdn_test.sh
while read Inode Flags Age Date Size Filename
do
echo $Inode $Flags $Age $Date $Size $Filename
if [[ $Flags = "FN.." && $Age = "100%" ]]
then
#exec ntfsundelete /dev/sdb7 -u -i $Inode -o $Inode -d /home/fuxiang &
echo $Inode
fi
done