From 2e6e8ca8b431251800392b455b2c70e6b0fbc881 Mon Sep 17 00:00:00 2001 From: Managor <42655600+Managor@users.noreply.github.com> Date: Fri, 4 Aug 2023 16:20:09 +0300 Subject: [PATCH] select: add page (#10578) --- pages/linux/select.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 pages/linux/select.md diff --git a/pages/linux/select.md b/pages/linux/select.md new file mode 100644 index 000000000..ed33ebf79 --- /dev/null +++ b/pages/linux/select.md @@ -0,0 +1,16 @@ +# select + +> Bash builtin construct for creating menus. +> More information: . + +- Create a menu out of individual words: + +`select {{word}} in {{apple}} {{orange}} {{pear}} {{banana}}; do echo ${{word}}; done` + +- Create a menu for picking a file or folder from the current directory: + +`select {{file}} in *; do echo ${{file}}; done` + +- Create a menu from a Bash array: + +`{{fruits}}=({{apple}} {{orange}} {{pear}} {{banana}}); select {{word}} in ${{{fruits}}[@]}; do echo ${{word}}; done`