Luciano ES <lucm...@gmail.com> writes:

Hi Luciano,

> I am porting an old shell script to fish and just ran into this nice
> structure:
>
> ---------------------------------
> PS3="Choose target: "
> select TARGET in option1 option2 option3 quit
> do
> ...
> done
> ---------------------------------
>
> Is there anything similar in fish?

No, I think, see https://github.com/fish-shell/fish-shell/issues/4036.

But you can do something like that using some other external command
like fzf, e.g.:

--8<---------------cut here---------------start------------->8---
set -l result (echo "foo
bar
baz" | fzf --prompt "Choose wisely: ")
echo $result # either foo, bar, or baz
--8<---------------cut here---------------end--------------->8---

Of course, now your script relies on fish *and* fzf (or whatever other
external command you might want to use as selection UI).

Bye,
Tassilo



_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to