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″]

[/codesyntax]

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.

Source

Tags: ,

Category: Programming

Leave a Reply