I'm searching for a way to catch the value of function keys in a variable, when a user push the function key. I have tried with dd command but only the letters or numbers keys are trapped: dd command doesn't work why the function keys.
Here ae several tests lines I have tried but the variable always return nothing with function keys :
dd if=/dev/tty bs=2 count=2 2>/dev/null
selection=$(dd bs=2 count=2 2>/dev/null)
dd bs=1 count=1 2>/dev/null
selection=$(dd bs=1 count=1 2>/dev/null)
For example - when I push F3 key, value ^[[13~ appears on screen but when doing echo selection=$selection, my variable "selection" remains empty (selection=)
- when I push d key, value d appears on screen and when doing echo selection=$selection, my variable "selection" equal (selection=d)
Can someone help me? What am I doing wrong? Why doesn't it work with function keys (F3...)?