![如何搜索存储在变量中的文本?](https://linux22.com/image/129344/%E5%A6%82%E4%BD%95%E6%90%9C%E7%B4%A2%E5%AD%98%E5%82%A8%E5%9C%A8%E5%8F%98%E9%87%8F%E4%B8%AD%E7%9A%84%E6%96%87%E6%9C%AC%EF%BC%9F.png)
#!/bin/bash
num=$(gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings | grep -oE '[0-9]+'|sort -rn|head -n 1)
key=$(gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings)
newnum=$(grep -oE '[0-9]+' $key |sort -rn|head -n 1)
echo $newnum
grep
接受$key
as 文件名,但我希望它搜索存储在变量 中的文本$text
。