[참고] TUI - dialog
● 설치
# yum install dialog
● 실습
[예제 1] 간단한 메시지 박스
dialog --msgbox "Hello, World!" 10 30
[예제 2] 입력 박스
dialog --inputbox "Enter your name:" 10 30 2>input.txt
[예제 3] 메뉴 박스
1 "Option 1" \
2 "Option 2" \
3 "Option 3" \
4 "Option 4"

[예제 4] Yes/No 대화 상자
dialog --yesno "Do you want to continue?" 10 30
[예제 5] 체크리스트
dialog --checklist "Select options:" 15 50 4 \
1 "Option 1" off \
2 "Option 2" off \
3 "Option 3" on \
4 "Option 4" off
[예제 6] 대화 상자
dialog --title "Default Services" --menu "Choose one of the following options:" 15 50 4 \
1 "SERVICE TYPE : DEFAULT" \
2 "AGENT" \
3 "Another option" \
4 "Yet another option"
[예제7 ] 스크립트 Dialog
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
#!/bin/bash
HEIGHT=15
WIDTH=40
CHOICE_HEIGHT=4
TITLE="Default Services"
MENU="Choose one of the following options:"
OPTIONS=(1 "SERVICE TYPE : DEFAULT"
2 "AGENT"
3 "Another option"
4 "Yet another option")
CHOICE=$(dialog --clear \
--backtitle "Rocky Linux Configuration" \
--title "$TITLE" \
--menu "$MENU" \
$HEIGHT $WIDTH $CHOICE_HEIGHT \
"${OPTIONS[@]}" \
2>&1 >/dev/tty)
clear
if [ $? -eq 0 ]; then
echo "You chose option $CHOICE"
else
echo "You canceled the dialog."
fi
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
# chmod +x dialog_script.sh
# ./dialog_script.sh