Files
openGauss-OM/script/local/expect.sh
coolany eae422baf3 适配CM组件
Signed-off-by: coolany <kyosang@163.com>

support cgroup

追加合入
2022-03-05 18:51:52 +08:00

29 lines
746 B
Bash

#!/bin/bash
#############################################################################
# Copyright (c): 2021-2025, Huawei Tech. Co., Ltd.
# FileName : expect
# Version : V1.0.0
# Date : 2020-01-13
#############################################################################
read -r secret
expect_content="$1"
passwd=$secret
cmd="$2"
func_remote_execute_cmd()
{
echo "Access Method"
echo "cmd:$cmd"
expect -c "
spawn $cmd;
expect {
\"please enter the password:\"
{send $passwd\n; exp_continue}
\"please enter the password again:\"
{send $passwd\n} }
expect eof
catch wait result;
exit [lindex \$result 3]"
}
func_remote_execute_cmd