Code Sample |
#!/bin/bash FSTAB=/etc/fstab TMPDIR=/home/dsl # change noauto, to auto, mount for use of mount -a sed 's/ noauto,/ auto,/g' $FSTAB >$TMPDIR/fstab.1 # double mount of /cdrom will make filetool.sh backup fail # to prevent the double mount of the /cdrom # find the device for mointpoint /cdrom MOUNTPOINT="$(grep -i /cdrom\ /etc/mtab|awk '{print $1}')" #this is the line we will remove REMLINE="$(grep -i $MOUNTPOINT $TMPDIR/fstab.1)" # copy all lines we want to keep grep -v $MOUNTPOINT $TMPDIR/fstab.1 >$TMPDIR/fstab.2 # tell wich line we removed echo "#Removed by HENK1955" >>$TMPDIR/fstab.2 echo "#$REMLINE" >>$TMPDIR/fstab.2 cp -f $TMPDIR/fstab.2 $FSTAB |