I want to make a script for zsh command line. It is a separate .sh file, I launch it through bash myscriptname, it asks me to input some values for variables and provides a result.
The problem is the following. If I use prompt though echo it works fine. But if I put prompt into straight into read (I want the input to be on the same line) I get a different outcome. Upon launch, it prints a space line and for any next input (enter or any other key) gives me "not a valid input".
script 1 (prompt in echo)
echo "type in v1 "
read v1
echo "Variable v1 is equal to $v1"
script 2 (prompt in read)
read "?type in v1 " v1
echo "Variable v1 is equal to $v1"
How should this be fixed?