I have a script that reads a line from stdin and perform some operations based on the line's contents. I need to bind a key to that script so it can be called simply by typing Ctrl-t. When I call the script by its name it works as expected, but when I hit the key binding it hangs. In fact the shell hangs and I have to kill it. The script uses read -r line
. I tried with cat
with same results.
Script looks like this (file name read.sh):
#!/bin/bash
echo -n ' > '
read -r buf
echo "you typed $buf"
Bind like this:
bind -x '"\C-t" : "read.sh"'