Quantcast
Channel: Active questions tagged fish - Stack Overflow
Viewing all articles
Browse latest Browse all 92

How to ask for user input with a default answer

$
0
0
   read -p 'set_color green; echo -n "$prompt Do you like to succeed? [Y/n]: "; set_color normal' -l confirm   switch $confirm   case Y y ''      command   case N n      return 1

So, I imagined '' would allow us to press the Enter key and accept that as a yes.

And it does not. The documentation says sadly nothing about default values for reads.

How could I make this to accept a default input?

https://fishshell.com/docs/current/cmds/read.html


Viewing all articles
Browse latest Browse all 92

Trending Articles