特别感谢作者:sjqu兄
这就是我的一个,请多指教。代码:
#!/bin/bash
#bakup /etc/fstab
cp /etc/fstab /etc/fstab.orig
# config
fdisk -l /dev/hda |grep FAT >>temp
fdisk -l /dev/hdb |grep FAT >>temp
fdisk -l /dev/hdc |grep FAT >>temp
fdisk -l /dev/hdd |grep FAT >>temp
#sort
awk '$0~/\*/ {print $1" "$NF}' temp >>pt
awk '$0!~/\*/ {print $1" "$NF}' temp >>pt
i=142
while read disks fstype
do
if [ $fstype = "FAT32" ]; then
disks_FS=vfat
else
disks_FS=msdos
fi
i=`expr $i + 1`
if [ "${i:2}" != "8" -a "${i:2}" != "9" ]; then
echo -e "$disks"\\t"/mnt/"\\$i""\\t"$disks_FS"\\t"iocharset=gb2312,codepage=936,umask=0 0 0" >>/etc/fstab
fi
done
rm -f temp pt
阅读(763) | 评论(0) | 转发(0) |