linux command dialog

Linux command dialog

Purpose

       Learning how to use dialog commad, do  man-machine interaction.

 

Eevironment

       Ubuntu 16.04 terminal

 

Procdeure

       Source code:

      

#!/bin/bash

TTY_X=$(($(stty size | awk '{print $2}')-6)) # determine terminal width
TTY_Y=$(($(stty size | awk '{print $1}')-6)) # determine terminal height
# We'll use this title on all menus
backtitle="test dialog"

options+=("yes" "U-boot and kernel packages")
options+=("no" "Full OS image for flashing")
KERNEL_ONLY=$(dialog --stdout --title "Choose an option" --backtitle "$backtitle" --no-tags --menu "Select what to build" 
$TTY_Y $TTY_X $(($TTY_Y - 8)) "${options[@]}")
echo "KERNEL_ONLY=$KERNEL_ONLY"
unset options

  test result :

  

原文地址:https://www.cnblogs.com/lianghong881018/p/10315062.html