mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-02-11 16:47:30 +00:00
Update cheatsheets
This commit is contained in:
21
linux/select
Normal file
21
linux/select
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
syntax: markdown
|
||||
tags: [tldr, linux]
|
||||
source: https://github.com/tldr-pages/tldr.git
|
||||
---
|
||||
# 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`
|
||||
Reference in New Issue
Block a user