方法有多种,这种直接存放的办法好:

#!/bin/bash

LOCAL_DIR=./server_dir
if [ ! -d ${LOCAL_DIR} ]; then
mkdir ${LOCAL_DIR}
fi

S_USERNAME=testuser
S_PASSWORD=123456
S_PATH=//10.11.10.3/files

sudo mount -t cifs -o \
username=${S_USERNAME},password=${S_PASSWORD} \
${S_PATH} \
${LOCAL_DIR}