융융이'Blog

리눅스 Dialog 사용법 본문

System_Engineering/Linux

리눅스 Dialog 사용법

바로퇴장 2020. 6. 26. 12:38
반응형
Usage: dialog <options> { --and-widget <options> }
where options are "common" options, followed by "box" options
  • Special options:
    [--create-rc "file"]

  • Common options:

      [--ascii-lines] [--aspect <ratio>] [--backtitle <backtitle>] [--beep]
      [--beep-after] [--begin <y> <x>] [--cancel-label <str>] [--clear]
      [--colors] [--column-separator <str>] [--cr-wrap] [--date-format <str>]
      [--default-button <str>] [--default-item <str>] [--defaultno]
      [--exit-label <str>] [--extra-button] [--extra-label <str>]
      [--help-button] [--help-label <str>] [--help-status] [--hfile <str>]
      [--hline <str>] [--ignore] [--input-fd <fd>] [--insecure] [--item-help]
      [--keep-tite] [--keep-window] [--last-key] [--max-input <n>]
      [--no-cancel] [--no-collapse] [--no-cr-wrap] [--no-items] [--no-kill]
      [--no-label <str>] [--no-lines] [--no-mouse] [--no-nl-expand]
      [--no-ok] [--no-shadow] [--no-tags] [--nook] [--ok-label <str>]
      [--output-fd <fd>] [--output-separator <str>] [--print-maxsize]
      [--print-size] [--print-version] [--quoted] [--scrollbar]
      [--separate-output] [--separate-widget <str>] [--shadow]
      [--single-quoted] [--size-err] [--sleep <secs>] [--stderr] [--stdout]
      [--tab-correct] [--tab-len <n>] [--time-format <str>] [--timeout <secs>]
      [--title <title>] [--trace <file>] [--trim] [--version] [--visit-items]
      [--yes-label <str>]

BOX 옵션

옵션 명 옵션 값
--buildlist <text> <height> <width> <tag1> <item1> <status1> ...
--calendar <text> <height> <width> <day> <month> <year>
--checklist <text> <height> <width>
--editbox <file> <height> <width>
--form <text><height><width><form height><label1><l_y1><l_x1><item1><i_y1><i_x1><flen1> <ilen1>...
--fselect <filepath> <height> <width>
--gauge <text> <height> <width> [<percent>]
--infobox <text> <height> <width>
--inputbox <text> <height> <width> [<init>]
--inputmenu <text> <height> <width> <menu height> <tag1> <item1>...
--menu <text> <height> <width> <menu height> <tag1> <item1>...
--mixedform <text> <height> <width> <form height> <label1> <l_y1> <l_x1> <item1> <i_y1> <i_x1> <flen1> <ilen1> <itype>...
--mixedgauge <text> <height> <width> <percent> <tag1> <item1>...
--msgbox <text> <height> <width>
--passwordbox <text> <height> <width> [<init>]
--passwordform <text> <height> <width> <form height> <label1> <l_y1> <l_x1> <item1> <i_y1> <i_x1> <flen1> <ilen1>...
--pause <text> <height> <width> <seconds>
--prgbox <text> <command> <height> <width>
--programbox <text> <height> <width>
--progressbox <text> <height> <width>
--radiolist <text> <height> <width> <list height> <tag1> <item1> <status1>...
--rangebox <text> <height> <width> <min-value> <max-value> <default-value>
--tailbox <file> <height> <width>
--tailboxbg <file> <height> <width>
--textbox <file> <height> <width>
--timebox <text> <height> <width> <hour> <minute> <second>
--treeview <text> <height> <width> <list-height> <tag1> <item1> <status1> <depth1>...
--yesno <text> <height> <width>

사용 예시 :

function removectn {
  sudo docker ps -a | grep -v 'CONTAINER' > statusctn.txt
  if [ -n "$(cat statusctn.txt)" ];then
    dialog --radiolist "container list" 20 150 4\
    $(while read line
      do
        echo "$line OFF" | gawk '{print $1, $(NF-1), $NF}'
      done < statusctn.txt)\
    2>deletecnt.txt
    dialog --infobox "removing container $(cat deletecnt.txt)" 5 30 ; sleep 1
    docker rm -f $(cat deletecnt.txt)
  else
    dialog --infobox "no container" 5 30; sleep 1
  fi
}

위 코드는 --radiolist를 이용하여 container 목록들을 보여주는 화면을 구성한 것이다.

여기서 중요한 건 선택된 내용은 종료코드 2 에 값이 저장되어 해당 내용을 보여줄려면 2>변수를 이용해 값을 저장한다.

실습코드 : https://github.com/gmldbd94/rapa/tree/master/linux_shell_script/dockermgmt

반응형

'System_Engineering > Linux' 카테고리의 다른 글

Linux 환경에서 디스크 마운트하기  (0) 2020.08.13
트래픽 확인하기_vnstat  (0) 2020.06.29
리눅스 기본  (0) 2020.06.26
Log Level  (0) 2020.06.18
[꿀팁]on-my-zsh 설치 및 plugin 설정  (0) 2020.06.18
0 Comments
댓글쓰기 폼