1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-07-24 05:35:23 +02:00

select: add page (#10578)

This commit is contained in:
Managor 2023-08-04 16:20:09 +03:00 committed by GitHub
parent 733eced5ad
commit 2e6e8ca8b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

16
pages/linux/select.md Normal file
View file

@ -0,0 +1,16 @@
# select
> Bash builtin construct for creating menus.
> More information: <https://www.gnu.org/software/bash/manual/bash.html#index-select>.
- 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`