read
, without -r
expects words on input to be delimited by the characters of the $IFS
special parameter (by default SPC, TAB and NL, though as read
reads only one line unless it ends in backslash, NL can't count) where backslash can be used to escape the separator or allow a line to be continued on the next physical line (backslash-newline sequences removed).
So, here the user must enter the values for P, N, R space or tab separated, like:
value_for_P value_for_N value_for_R
Or if the values can contain space:
value\ for\ P value\ for\ N value for R
(here we didn't bother escaping the spaces for R as the rest of the line after the third word would end-up in R anyway; the user would still need to escape a trailing space though).
If you want the user to enter the values on 3 lines, you'd need 3 read
invocations. You'd then want -r
to avoid the backslash processing and make IFS empty:
IFS= read -r P IFS= read -r N IFS= read -r R