Straight to the point, I have a script that will
read user input and interactively prompts before printing the final output which is expected to be obtainable by the calling user like so:
AVAR=$(myscript arg1 arg2 arg3)
So I came up with a dirty[?] hack[?] in myscript:
# ... blah ... echo -n "A prompt for the user " >> /dev/stderr read SOMEVAR >> /dev/null # ... other stuff ... printf "Results\t$RESULT\n"
Is this some sort of evil, bad practice using stderr or am I just being resourcefully sly? Excuse my ignorance, I'm 100% self-taught so I'm using deductive reasoning, ie, everything I don't want in the caller's variable must be redirected, but in the case of prompts, it still needs to be displayed, and stderr was are I could come up with.