简体   繁体   中英

How to detect TAB key in BASH?

I have this piece of bash code below,

#!/bin/bash

while true; do
read -rsn1 input
if [ "$input" = "a" ]; then
    echo "triggered"
fi
done

It works fine when I press "a" key, however what I really want is trigger something when user press TAB key. How can I make it work? Many thanks for help!

如果您不希望使用IFS拆分扫描,则将IFS设置为空。

IFS= read -rsn1 input

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM