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/stderrread SOMEVAR >> /dev/null# ... other stuff ...printf Results\t$RESULT\nIs 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.
Good or bad practice? Redirecting to stderr?
shell script;io redirection;stderr
Solved: Yes, this is bad practice.Thanks @SatoKatsura for filling in the blanks.The correct thing to do is:# ... blah ...echo -n A prompt for the user  >&2read SOMEVAR >> /dev/null# ... other stuff ...printf Results\t$RESULT\nWhich is portable and better, safer practice.