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 :

  

posted @ 2019-01-24 16:08  嵌入式实操  阅读(237)  评论(0编辑  收藏  举报