I know tmux run-shell can execute shell:
$ tmux run-shell "echo start; echo \${var}end"
start
end
But what if I want my shell could work interactively or read some user input,
$ tmux run-shell "echo start; read -p \"prompt:\" var; echo \${var}end"
start
end
- Why read statement in above code doesn't work?
- Could any tmux expert let me know ways to implement interactive action with tmux?
Background:
- I put my various common work into a single kit.sh
as functions all the time
- There are many interactive questions in this script
- Now I want to reuse this kit.sh
with tmux hot key, as bind-key i "run-shell \"kit.sh\""
in my .tmux.conf
- I'm planing to add some tmux send-keys
in this kit.sh
for kind of auto-type functions
**Update 20231016:**
My problem is solved as
bind-key i "new-window \"/path/to/my/kit.sh\""
And in kit.sh I can read user input interactively.
Asked by Qiu Yangfan
(204 rep)
Oct 13, 2023, 04:34 AM
Last activity: Oct 16, 2023, 06:40 AM
Last activity: Oct 16, 2023, 06:40 AM