Re: [問題] Shell Script如何讀dialog的回傳值?

看板Linux作者時間15年前 (2010/11/30 12:32), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串4/4 (看更多)
※ 引述《darkgerm.bbs@ptt.cc (黑駿)》之銘言: > 謝謝~~用方法二可以跑了~~~ > 用方法一還是不行= = > 但是我在工作站裡找不到 dialog 的範例0.0 > 在 /usr/share/doc/ 裡沒有,man dialog 也沒有例子… > 工作站環境:FreeBSD 8.1-RELEASE FreeBSD 的一些環境會和 Linux 不同,大部分 Linux distro 比較接近 SysV, FreeBSD 則顧名思義,比較接近 BSD。manpage 中沒有例子應該是意料中的事情, 在 Linux 上,以我的 Ubuntu Linux 10.04 來說, dialog 的 manpage 中, "EXAMPLE" section 是這樣說的: EXAMPLES The dialog sources contain several samples of how to use the different box options and how they look. Just take a look into the directory samples/ of the source. 換句話說,範例在 dialog 原始碼中有包在裏面,但是各個 distro 會放在哪 就很難說了。尤其是 FreeBSD 放的位置更可能跟 Linux 完全不同。在我的系 統上,dialog 的範例是放在 /usr/share/doc/dialog/examples/ 下: $ ls /usr/share/doc/dialog/examples/ calendar fselect-stdout inputmenu2 msgbox4-eucjp calendar2 gauge inputmenu3 msgbox4-utf8 calendar2-stdout gauge0-input-fd inputmenu4 password calendar-stdout gauge2 inputmenu-stdout password1 checklist gauge3 menubox password2 checklist10 infobox menubox1 pause checklist-utf8 infobox2 menubox10 radiolist dselect infobox3 menubox2 radiolist10 editbox infobox4 menubox3 textbox editbox2 inputbox menubox4 textbox2 editbox-utf8 inputbox1 menubox5 timebox form1 inputbox2 menubox-utf8 timebox2 form2 inputbox3 mixedform timebox2-stdout fselect inputbox4 mixedform2 timebox-stdout fselect1 inputbox5 mixedgauge yesno fselect1-stdout inputbox6-utf8 msgbox yesno2 fselect2 inputbox7 msgbox1 yesno3 fselect2-stdout inputmenu1 msgbox2 我之前回覆的方法一是參考 calendar script 的寫法,方法二則是 menubox 的寫法。 此外,dialog 程式事實上有很多實作版本,像是在我的系統上的 dialog 是 cdialog: $ /usr/bin/dialog --help |head cdialog (ComeOn Dialog!) version 1.1-20080819 Copyright 2000-2007,2008 Thomas E. Dickey This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * Display dialog boxes from shell scripts * Usage: dialog <options> { --and-widget <options> } where options are "common" options, followed by "box" options 各種不同實作在行為上也可能有些許差異。所以到底要怎麼用,可能還是要看你 系統上的 dialog 的 manpage/info document 以及範例程式,才會比較準。 -- ※ Origin: SayYA 資訊站 <bbs.sayya.org> ◆ From: c-76-111-34-186.hsd1.ga.comcast.net

11/30 13:42, , 1F
謝謝~~真是太感謝你了>"<
11/30 13:42, 1F
文章代碼(AID): #1Cz7v2tN (Linux)
文章代碼(AID): #1Cz7v2tN (Linux)