You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
428 B
21 lines
428 B
2 years ago
|
#!/usr/bin/env sh
|
||
|
|
||
|
# This magical incantation allows the terminal to ask a question and receive an answer.
|
||
|
|
||
|
ask() {
|
||
|
# Display the prompt
|
||
|
echo "${1}"
|
||
|
|
||
|
# Read the user's input
|
||
|
read -r user_input
|
||
|
|
||
|
# Return the user's input
|
||
|
echo "${user_input}"
|
||
|
}
|
||
|
|
||
|
# Check if script is being sourced or executed
|
||
|
if [ "${BASH_SOURCE[0]}" = "$0" ]; then
|
||
|
# Script is being executed, call the function and pass the arguments
|
||
|
ask "$@"
|
||
|
fi
|