I have an awk script in
.bashrc that reads characters and modifies some keywords. It works perfectly when I pipe
tail -f and other basic commands through it, but I have a problem when I pipe ssh through it. Everything works fine as expected except I cannot see anything I type on terminal until I press return:
~# ssh admin@localhost -p 5200 | my-script admin@localhost's password: admin connected from 127.0.0.1 using ssh on home admin@ssh-server> exit ***<- I don't see this line (including the prompt) at all on terminal until I type my command (exit) and press Enter*** Connection to localhost closed.
I think I understand why it's behaving like that but don't know how to fix it. I think the interactive commands to ssh are not sent through pipe until EOL is returned. I have tried everything I found searching from unbuffer/stdbuf to tee/script and playing with various redirection commands but all without luck.
Note: I'm actually ok that the strings are passed to my-script after EOL, I just need to be able to see what I'm typing i.e. need terminal stdin to echo as usual.