F
F
fokin_nikolay19892017-03-16 15:30:03
bash
fokin_nikolay1989, 2017-03-16 15:30:03

How to modify sh?

There are two file test and ssh_connect
In test file I call gnome-terminal -e ./ssh_connect and pass variable $domain
In ssh_connect contains

#!/usr/bin/expect
source ./test
eval spawn ssh -oStrictHostKeyChecking=no -oCheckHostIP=no [email protected]$domain
#use correct prompt
set prompt ":|#|\\\$"
interact -o -nobuffer -re $prompt return
send "PASS\r"
interact -o -nobuffer -re $prompt return
send "cd\r"
interact

Everything is good in principle, but after the call, the terminal quickly opens and closes the terminal. Although if you put down all the ip and password, execute the ssh_connect file, then the terminal opens, authorization passes and you can work safely.
Tell me how to make it so that when the ssh_connect file is called from the test file, the terminal does not get stuck, but continues to hang

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
fokin_nikolay1989, 2017-03-16
@fokin_nikolay1989

Here is the solution to the problem!
gnome-terminal -x bash -i -c "./ssh_connect %d %f; read"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question