
我正在運行 yum 查詢
yum group info 'X Window System'
輸出如下
yum group info 'X Window System'
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.vanehost.com
* extras: mirror.vanehost.com
* updates: mirror.vanehost.com
Group: X Window System
Group-Id: x11
Description: X Window System Support.
Mandatory Packages:
-glx-utils
-initial-setup-gui
=mesa-dri-drivers
=plymouth-system-theme
=spice-vdagent
+xorg-x11-drivers
=xorg-x11-server-Xorg
=xorg-x11-utils
=xorg-x11-xauth
=xorg-x11-xinit
=xvattr
Optional Packages:
mesa-libGLES
tigervnc-server
wayland-protocols-devel
xorg-x11-drv-evdev
xorg-x11-drv-keyboard
xorg-x11-drv-libinput
xorg-x11-drv-mouse
xorg-x11-drv-openchrome
但是當我對此運行 grep 來過濾掉以 - 或 + 開頭的行時
yum group info 'X Window System' | grep -E "^[-+]"
我得到一個空白輸出。有人可以讓我知道我哪裡出了問題嗎?
答案1
這些行不以+
或開頭-
,而是以空格開頭。嘗試
grep -E "^[[:blank:]]*[-+]"