Code: Select all
Exec ["tmux", "send-keys", "cat foo | grep bar" & "\r\n"]
For this to work, the Gambas CLI executable app has to be executed from a shell (CLI) with TMUX already active.
The last two characters, "\r\n" inserts a carriage return and newline at the end of the string sent to tmux to simulate the user pressing the Enter key.
While this looks trivial, it means Gambas + tmux can be used to manipulate the terminal in just about any possible way which allows for extremely powerful scripts to be written in Gambas. This will allow actions such as changing the active directory in the shell that called the script. Such a directory change will then survive the script termination, something that is impossible by design in the Linux security model.