Przeglądaj źródła

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>
Managor 1 rok temu
rodzic
commit
56d77e0f72
1 zmienionych plików z 6 dodań i 2 usunięć
  1. 6 2
      pages/linux/select.md

+ 6 - 2
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: