Thanks for all the answers, I'm almost got the script working but there is some problem regarding '$*'. It return the absolute path to the file instead of only the file name.
PHP Code:
#!/bin/bash
#
# nautilus-mount-iso
gksudo -u root -k /bin/echo "Enter your password for root terminal access"
zenity --info --text "TEST /media/$*/"
TYPE = "$(file "$*" | cut -c 3-6)"
if [-d /media/"$*" ]; then
if [ zenity --question --title "ISO Mounter" --text "Unmount $*?" ]
sudo umount "$*"
zenity --info --text "Successfully unmounted /media/$*/"
sudo rmdir "/media/$*/"
exit 0
else
exit 1
fi
else
sudo mkdir /media/"$*"
if [ "$TYPE"==ISO ]; then
if [ sudo mount -o loop -t iso9660 "$*" /media/"$*" ]; then
zenity --info --title "ISO Mounter" --text "$* Successfully Mounted."
exit 0
else
sudo rmdir /media/"$*"
zenity --error --title "ISO Mounter" --text "Cannot mount $*!"
exit 1
fi
elif [ "$TYPE"==UDF ]; then
if [ sudo mount -t udf -o loop $1 /media/"$*" ]
zenity --info --title "ISO Mounter" --text "$* Successfully Mounted."
exit 0
else
sudo rmdir /media/"$*"
zenity --error --title "ISO Mounter" --text "Cannot mount $*!"
exit 1
fi
else
sudo rmdir /media/"$*"
zenity --error --title "ISO Mounter" --text "Cannot mount $*!"
exit 1
fi
fi
Bookmarks