From 56d77e0f722537b04e7a83efc3e4d45a26114cdd Mon Sep 17 00:00:00 2001 From: Managor <42655600+Managor@users.noreply.github.com> Date: Sun, 25 Feb 2024 18:51:18 +0200 Subject: [PATCH] select: update page (#12325) * select: update page --------- Co-authored-by: Vitor Henrique <87824454+vitorhcl@users.noreply.github.com> Co-authored-by: Lena <126529524+acuteenvy@users.noreply.github.com> Co-authored-by: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com> --- pages/linux/select.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pages/linux/select.md b/pages/linux/select.md index ed33ebf79..b0c9471cf 100644 --- a/pages/linux/select.md +++ b/pages/linux/select.md @@ -7,9 +7,13 @@ `select {{word}} in {{apple}} {{orange}} {{pear}} {{banana}}; do echo ${{word}}; done` -- Create a menu for picking a file or folder from the current directory: +- Create a menu from the output of another command: -`select {{file}} in *; do echo ${{file}}; done` +`select {{line}} in $({{command}}); do echo ${{line}}; done` + +- Specify the prompt string for `select` and create a menu for picking a file or folder from the current directory: + +`PS3="{{Select a file: }}"; select {{file}} in *; do echo ${{file}}; done` - Create a menu from a Bash array: