Created
January 19, 2017 16:16
Star
You must be signed in to star a gist
A bash function to write a given message and retrieve response in named variable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First argument is the name of the variable in which you want the answer to be. | |
# Next arguments will compose the message to show to the user before starting | |
# the reading. An additional space will be added at the end of the message. | |
print_message_read_response() { | |
var_name="$1" | |
eval $var_name= | |
shift | |
read -p "$* " $var_name | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment