How to avoid blackboxing function output in bash?
If I have a bash script that is purely made of functions, how do I get
things like prompts to show up in the terminal? For example, consider the
following:
prompt() {
read -p "This is an example prompt. [Y/n]"
}
main() {
prompt
}
How do I get that prompt message to show up in the terminal? When I just
call prompt() from main(), it blackboxes the whole prompt() function. Do I
have to return something from prompt()? What if I want to echo a bunch of
messages after the read in prompt()? How do I get those to show up in the
terminal?
I think I'm missing a basic programming concept here.
No comments:
Post a Comment