Bash script to log in over SSH
Posted
by
user1042928
on Stack Overflow
See other posts from Stack Overflow
or by user1042928
Published on 2011-11-12T09:48:26Z
Indexed on
2011/11/12
9:50 UTC
Read the original article
Hit count: 377
Sorry if this seems like a dumb question but I am just learning bash scripting. For a school project we need to code an RTX that runs in Unix. It runs as a process in terminal and takes in user input and then prints it to the screen. I want to write a bash script to test that it can respond to lots of quick user input without overflowing or failing.
My main problem is that once the RTX starts the bash script will stop on that line until the RTX terminates and only then print the loop to the terminal (instead of printing it to the RTX prompt as I intend it to).
I have tried running the RTX in the background but that didn't work. I need to find a way to redirect input to the RTX while it is still running with a bash script. Google searches didn't come up with examples that I understood/could adapt. Any help is appreciated.
#!/bin/bash
# declare STRING variable
STRING="RTX Worked =D"
#Start the rtx in a new process, stuck on this line until rtx terminates.
./main
#Somehow redirect io to the rtx.
for i in `seq 1 100`;
do
echo $i
echo " \n"
done
echo $STRING
© Stack Overflow or respective owner