I would like to be able to run a program and then feed that program some information all in one line on startup. Suppose I am in the working directory of the executable (sage), I can run
./sage -c "print('hi')"
and it will write hi to the terminal. It's clearly fed sage the command to print, and then grabbed the output. What I would like to do is feed it that print command, but then also keep the program running in the background until I close the terminal. Is there some way to do this? To further describe it, I would like linux to start ./sage, wait for it to open, and then feed it a command and leave it running. Is this possible? It feels like it should be because -c is able to feed it a command.
Please note I am trying to access ./sage and grab its output from pascal, and in pascal the best I can do is write one line to the terminal, so I do not have the ability to do multiple lines.