鞭尾行動

鞭尾行動

私のコード:

read -ra var <<<$(sed -ne's/^ *:\([[:upper:]]*\).*/\1/p' /etc/sysconfig/iptables)
chains=$(whiptail --title "Add rule" --menu "chains" 16 78 5 "${var[@]}" 3>&1 1>&2 2>&3)

ファビテールメニューに利用可能なすべてのiptablesチェーンを含めたいのですが、スクリプトを実行すると、次のような結果が表示されます。

ルールの追加ウィンドウが空のスクリーンショット

ただし、Whip tail 構文を追加すると、--ok-button次の結果が表示されます。

chains=$(whiptail --title "Add rule" --menu "chains" 16 78 5 --ok-button "${var[@]}" 3>&1 1>&2 2>&3)

出力転送選択スクリーンショット

--ok-button(たとえば、Ok)の後にいくつかの選択肢を作成する必要があることを知っていますが、このスクリプトを実行すると、最初の図に示されている内容が得られます。

Beyond--menuタグを追加しましたが、--notagsまだ最初の画像に表示されているものを取得しました。

スペースを削除すると、次のようになります。

chains=$(whiptail --title "Add rule" --menu "chains" 16 78 5 --ok-button Ok"${var[@]}" 3>&1 1>&2 2>&3)

わかります:

出力選択スクリーンショット

--notagsまあ、配列の項目だけを表示するラベルを追加したいと思います。var

この問題を解決するにはどうすればよいですか?

ベストアンサー1

オプション--notags--ok-button消えなければなりません今後オプション--menu。その修正された行動メニュー小さな部品。

出荷書類ビーチ鞭の尾少し作業が必要です。次のマニュアルページがあります。会話役に立った:私は次からstrings /usr/bin/whiptail見る鞭の尾オプションはありますが--notags説明はありません。鞭の尾~のマンページ。ダイアログボックスで:

   --no-tags
          Some  widgets  (checklist, inputmenu, radiolist, menu) display a
          list with two columns (a "tag" and "description").  The  tag  is
          useful  for scripting, but may not help the user.  The --no-tags
          option (from Xdialog) may be used to suppress the column of tags
          from  the  display.  Unlike the --no-items option, this does not
          affect the data which is read from the script

会話--notagsにマップ-no-tagsX会話後者の名前を使用して関数を最初に実装します。

おすすめ記事