我知道,包含空格的组名称必须用引号引起来,而且它们仍然不符合我的预期:
export instdesk="xterm java-1.8.0-openjdk xrdp tigervnc-server"
export grpdesk=(Desktop "Desktop Platform" "General Purpose Desktop" "X Window System" "Legacy X Window System compatibility" Fonts)
yumdesk() {
for ginstdesk in "${grpdesk[@]}"; do
yum -y groupinstall $ginstdesk
done
}
简单地尝试过yum -y groupinstall ${grpdesk[*]}
仍然行不通。
答案1
显然$ginstdesk的值有空格,所以需要加引号。