sshpass使用
#!/bin/bash
passwd='root'
host='10.1.1.1'
filename=$1
projectname=$2
BRANCH_NAME=$3
sshpass -p "$passwd" scp -o StrictHostKeyChecking=no "$filename" root@"$host":/opt/
sshpass -p "$passwd" ssh -o StrictHostKeyChecking=no root@"$host" "
cd /opt
rm -rf '$BRANCH_NAME'
mkdir -p '$BRANCH_NAME'
unzip -q '$filename' -d '$BRANCH_NAME'
rm -f '$filename'
cd '$BRANCH_NAME'/'$projectname'
cp jenkins_script/start.sh .
sh start.sh
"