MAXSIZE=`df -a | grep -v 'Filesystem' | grep "/file[1-9][0-9]*"; |awk '{print $4}' |sort -n -u -r |head -1`
if [ $MAXSIZE -lt 15728640 ];then
echo "15G must have!"
exit 1
fi
fi
list=`df -a | grep -v 'Filesystem' | grep "/file[1-9][0-9]*"; `
for i in "$list"
do
size=`echo "$i" |awk '{print $4}'`
if [ "$size" -gt 15728640 ];then
FILE=`echo "$i" |awk '{printf $6}'`
echo "$FILE has the area,do you want to use this filesystem(Y|N)!"
while :
do
read answer
if [ "$answer" = "Y" -o "$anser" = "y" ] ; then
break;
elif [ "$answer" = "N" -o "$answer" = "n" ];then
break;
else
echo "input error"
fi
done
if [ "$answer" = "Y" -o "$answer" = "y" ];then
cd "$FILE"
break;
else
continue;
fi
fi
done
shell实现寻找合适分区的脚本
最新推荐文章于 2025-08-15 14:18:18 发布