在shell脚本中插入expect脚本需要加入expect <<- EOF,在expect里面怎么下注释呢?前面加#不行,会报错;
比方说下面这段代码:
!/bin/bash
if [ $# -ne 3 ]; then echo "3 arguments are needed:" echo "1-user 2-IP 3-password" exit else expect <<- EOF **# 我想在这里加入注释!!!** spawn ssh $1@$2 expect { "*(yes/no)?*" { send "yes\r" expect "password" send "$3\r" } "password" { send "$3\r" } } expect "*]*" ... ... EOF fi
我想在上段代码中标注的地方加注释,应该怎么写呢?
可以这样写