| |
---|
| | # tpromptuser.sh - User Prompting From Shell With validation |
---|
| | # Copyright (c) 2010-2012, TundraWare Inc, Des Plaines, IL USA |
---|
| | # All Rights Reserved. |
---|
| | # For Updates: http://www.tundraware.com/Software/tpromptuser |
---|
| | # $Id: tpromptuser.sh,v 1.111 2012/06/05 20:01:17 tundra Exp $ |
---|
| | # $Id: tpromptuser.sh,v 1.112 2012/06/05 20:11:04 tundra Exp $ |
---|
| | |
---|
| | ##### |
---|
| | # You are hereby granted a non-exclusive license to do whatever you |
---|
| | # like with this software so long as you understand this is |
---|
| |
---|
| | ##### |
---|
| | # tPromptUser() - Shell Function To Prompt And Validate User Input |
---|
| | ##### |
---|
| | |
---|
| | # Takes a list of prompts as arguments |
---|
| | |
---|
| | tPromptUser() |
---|
| | |
---|
| | { |
---|
| | |
---|
| | for x in $PROMPTLIST |
---|
| | for x in $* |
---|
| | do |
---|
| | eval record=\$$x # Get the prompt record |
---|
| | IFS=$DL # Get individual fields |
---|
| | read prompt default answers <<EOF |
---|
| |
---|
| | |
---|
| | |
---|
| | # Go get the user input and validate it |
---|
| | |
---|
| | PromptUser |
---|
| | |
---|
| | tPromptUser ${PROMPTLIST} |
---|
| | |
---|
| | # Dump results for sake of this example only |
---|
| | |
---|
| | printf "After: foo->$foo bar->$bar baz->$baz bat->$bat\n" |
---|
| | |