How to prompt user confirmation using Bash

June 2, 2014 | By | Reply More

I found a nice tips to create a prompt for user confirmation using Bash. Its pretty simple and neat. Here is the example to create a user confirmation (y/n) on Bash:

[codesyntax lang=”bash” lines=”normal” lines_start=”0″]


When user press y or Y, it will return “yes”. If user press n or N, it will return no. Otherwise it will return “invalid”. Its pretty easy.


Tags: ,

Category: Programming

Leave a Reply

%d bloggers like this: