Listing 1.
#usage smb computername sharename
#!/bin/sh
if [ $UID = 0 ]; then
if [ ! d /mnt/$1 ]; then
mkdir /mnt/$1
fi
# You may want to add the -u option here also
# if you need to specify a login id (ie: mounting
# drives on Windows NT)
/usr/sbin/smbmount //$1/$2 /mnt/$1 I $1 c etc
else
if [ ! d ~/mnt/ ]; then
mkdir ~/mnt/
fi
if [ ! d ~/mnt/$1 ]; then
mkdir ~/mnt/$1
fi
# You may want to add the -u option here also
# if you need to specify a login id (ie: mounting
# drives on Windows NT)
/usr/sbin/smbmount //$1/$2 ~/mnt/$1 I $1 c etc
fi
Copyright © 1994 - 2019 Linux Journal. All rights reserved.