#!/bin/bash

# list shares
#smbutil view -G //mini.nas | grep Disk | awk '{print $1" [mini, SMB]"}';
#echo "------------------------------------";
#smbutil view -G //ts.nas | grep Disk | awk '{print $1" [ts, SMB]"}';
#echo "------------------------------------";
#showmount -e benoit.nas | grep -v "Exports list" | awk '{print $1" [benoit, NFS]"}'


MOUNT=$KMVAR_selMount
#echo $MOUNT

MOUNT='/BenoitBalls [benoit, NFS]'
#MOUNT='aura [ts, SMB]'

M=`echo $MOUNT | awk '{print $1}' | sed 's/\///g'`
S=`echo $MOUNT | awk '{print $2}' | sed 's/\[//g' | sed 's/\,//g'`
T=`echo $MOUNT | awk '{print $3}' | sed 's/\]//g'`

echo $M

#if [[ "$S" == "benoit" ]]; then
#    $S=''
if [[ "$T" == "NFS" ]]; then
    #osascript -e "ignoring application responses" -e 'tell application "Finder" to mount volume "nfs://{$S}.nas/{$M}"' -e "end ignoring" 
    osascript -e 'tell application "Finder" to mount volume "nfs://'${S}'.nas/'${M}'"'
else
    open "smb://${S}.nas/${M}";  
fi
