天天看点

shell传参超过10个

shell传参,超过10个要用在shell中用{}保住,不然会识别为其他的。

#!/bin/bash
#@hydrate

# 入参
IP1=${1}       # 数据库IP
user1=${2}     # 远程数据库用户
PASSWD1=${3}   # 数据库密码
PORT1=${4}     # 数据库端口

DIR=${5}       # 备份目录

PASSWD2=${6}   # 数据库服务器root密码
PORT2=${7}    # ssh端口

IP2=${8}      # 备份机器IP
PASSWD3=${9}  # 备份机器root密码
PORT3=${10}    # ssh端口
           

继续阅读