I have two scripts:
test_input.shis a script which is executed through SSH. In this script I ask the user for something in input.test_ssh_connection.shis a script which connects tolocalhostand executes the scripttest_input.sh
In test_ssh_connection.sh I want to redirect the output of test_input.sh to a file, but in test_input.sh I want to display on screen the input prompt, becuase I want to be able to see that prompt.
This is my test_ssh_connection.sh:
echo "Connecting to localhost and executing an input script."
ssh "localhost" "sh test_input.sh" >> "test.txt"
this is test_input.sh:
echo -n "Give me a value: "
read value
echo "You gave me [${value}]."
Actually, this is the content of test.txt after executing test_ssh_connection.sh:
Give me a value: You gave me [asd].
Currently, the prompt Give me a value: is only in test.txt and not in terminal. Instead, what I want is to display it in the terminal and, if it's possibile, I would like to remove it from test.txt.
I've found this question, but it seems that if the subscript is called through ssh >/dev/tty/>$(tty) do not work.