代码拉取完成,页面将自动刷新
smb_mount() {
if [ -f ~/.smbrc ]; then
. ~/.smbrc
fi
local smb_host=$1
local smb_host_uri=$smb_user:$smb_password@$smb_host
local smb_share=$2
local smb_mount_point=$3
local result exit_code
if [ -z $smb_host ] || [ -z $smb_share ]; then
cat <<-USAGE
smb_mount {host} {share_name} {mount_point}
Parameters
==========
Host: The hostname or ip address only.
Sharename: The name of the share on the remote host.
Mount point: Optional (will default to /Volumes/{Sharename})
Authentication
==============
This function will use smb_user and smb_password environment variables,
or it will pull those values from a ~/.smbrc file. syntax is:
smb_user={username}
smb_password={password}
NOTE: no spaces between the equal sign.
USAGE
return 1;
fi
if [ -z $smb_mount_point ]; then
smb_mount_point=/Volumes/$smb_share
fi
if ! mount | grep " $smb_mount_point " >/dev/null; then
mkdir -p $smb_mount_point
echo mount -t smbfs //${smb_host_uri}/$smb_share $smb_mount_point
result=$(mount -t smbfs //${smb_host_uri}/$smb_share $smb_mount_point 2>&1)
exit_code=$?
if [ $exit_code -ne 0 ]; then
re='server connection failed: Socket is not connected'
if [[ $result =~ $re ]]; then
echo "'mount -t smbfs' failed, falling back to mount_smbfs"
result=$(mount_smbfs -s //${smb_host_uri}/$smb_share $smb_mount_point 2>&1)
exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "mount failed (exit_code: $exit_code): $result"
return 1
fi
fi
fi
else
echo "$smb_mount_point already mounted."
fi
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。