bash - 如何检测 BASH 中的 TAB 键?
问题描述
我在下面有这段 bash 代码,
#!/bin/bash
while true; do
read -rsn1 input
if [ "$input" = "a" ]; then
echo "triggered"
fi
done
当我按下“a”键时它工作正常,但是我真正想要的是当用户按下 TAB 键时触发一些东西。我怎样才能让它工作?非常感谢您的帮助!
解决方案
如果您不希望使用 分割扫描IFS
,则设置IFS
为空。
IFS= read -rsn1 input
推荐阅读
- typescript - 如何确定字符串是否是枚举的一部分?
- r - na.fail.default(list(Fe = c(568L, 437L, 599L, 1016L, 670L, 1951L, : 对象中的缺失值
- .net - Traefik 不会路由路径
- javascript - 从网络服务器摄像头录制
- next.js - 使用 index.js 以外的东西作为 next.js 目录中的主页
- android - 环绕图标的按钮?
- python - 如何修复 Pygame 无法打开文件“Gunshot.ogg”错误
- python - 使用opencv调整视频大小并保存
- kubernetes - kubernetes v1.18.8 安装问题
- javascript - EC2 网站中的 WebSocket 连接超时