#! /bin/bash ###################################### # mountiso.sh ###################################### { while [ $# -gt 0 ] do b=`basename $1` #file basename f=$1 ( [ "${f:0:1}" == "/" ] && #absolute file pathname p=${f%/$b} )|| #relative file pathname p=`pwd`/${f%/$b} ( (grep "$b" /etc/mtab &>1) && echo "$b already mounted!!!" )|| ( [ ! -d "$b" ] && mkdir $b t=("iso9660 -o loop") ( (file $1 | grep '/<ISO 9660/>' &>1) && true )|| t=(vfat ext2 ext3 ntfs) flag=0 for tt in "${t[@]}" #try mount type do (mount -t $tt "$1" "$b" &>1) && echo "$b mounted under /mnt namely..." && flag=1 && break done [ $flag -ne 1 ] && echo "fail: unkown mount type." unset flag ) shift done }
一个 挂载的简易脚本
最新推荐文章于 2024-07-17 17:31:38 发布