I often use more than one terminal (or terminal emulator) at a time; and while in X I can copy-paste commands, besides not being very practical, it obviously does not work on the real TTY. The first idea that occurs to me is something alike:
command > /dev/sometty
command is run before it is piped, and no tricks like
echo `command` will work, no matter how many weird bash characters (
", etc.) are there. So
/dev/sometty simply gets some text.
The problem is that, sometimes, it is even worth for I to pipe those commands into a file, make it executable, etc., or shortly: making a script and running it from the appropriate terminal. But that is a lot of work. I've been thinking of making a script to make these files, for an instruction:
termpipe -e "command1\ncommand2\"command 1 argument\\n(s)\"" -t /dev/sometty
it would do something like:
- pipe the commands to, say,
- make the file executable
- run the file in the appropriate terminal
- delete the script when it is done executing
AFAIK, the problem is in 3.: this doesn't solve any problem, as I'd need another
termpipe instance to run the first on the appropriate terminal. And one for that one. And another for that, ad infinitum. So this cannot work. Or can it?...
The solution could be to use a named pipe per terminal, and when each starts, a script would tell the pipe to forward anything it receives to the terminal, and then to execute it (like a sort of daemon).
I think this might work but I don't know how to set up the initial script. How can I? How can I tell the FIFO to give piped commands for the respective terminal to run? I don't know much Bash, so I'd appreciate full explanations.