deepin distro에서 설치 후 사용할 대화 상자가있는 간단한 bash 스크립트를 작성했습니다. 스크립트는 대화 상자로 만든 간단한 메뉴가 있습니다. 이제는 모든 명령이 완료된 후에 메뉴를 반복하는 방법을 모르겠습니다.bash에서 특정 코드 행 반복하기
sudo apt-get install dialog
cmd=(dialog --separate-output --checklist "Seleziona i programmi che vuoi installare:" 22 76 16)
options=(1 "Impostazione Mirror GARR" off # qualsiasi impostazione può essere impostata su "on"
2 "Aggiornamento di sistema" off
3 "Installazione font Microsoft" off
4 "Installazione Gdebi" off
5 "Synaptic" off
6 "BleachBit" off
7 "Open JDK 8" off
8 "Supporto lettura DVD" off
9 "LibreOffice" off
10 "VLC Media Player" off
11 "Flash Player" off
12 "Google Chrome" off
13 "Teamiewer" off
14 "Skype" off
15 "Brasero" off
16 "iFuse per supporto device Apple" off
17 "Kodi" off
18 "Gimp" off
19 "Telegram" off
20 "Enpass Password manager" off
21 "Opera Browser" off
22 "GUFW" off
23 "Vivaldi Browser" off
24 "Risparmio energetico TLP" off
25 "Pulizia del sistema" off)
choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)
clear
for choice in $choices
do
case $choice in
1)
#Setting mirror on italian server GARR
echo "Impostazione Mirror GARR"
cd $HOME &
cp /etc/apt/sources.list backup.sources.list
bash -c 'cat <<EOF> /etc/apt/sources.list
# Generated by deepin-installer
# deb [by-hash=force] http://packages.deepin.com/deepin unstable main contrib non-free
# deb-src http://packages.deepin.com/deepin unstable main contrib non-free
##########################################################################################
deb [by-hash=force] http://ba.mirror.garr.it/mirrors/deepin/ panda main contrib non-free
EOF'
sudo apt-get update
;;
2)
#Update of the repo and upgrade the system
clear
echo "Aggiornamento del sistema"
apt-get update && sudo apt-get upgrade -y
;;
옵션을 추가하고 전체 스크립트를 다루는 while 루프를 사용하십시오. –
예. 그러나 명령이 실행 된 직후에는 bash 스크립트가 종료됩니다. 스크립트의 모든 단일 명령에 대해 while 명령을 사용할 수 있습니다. – Fasbyte01