You could use a variable:
info="$(getInfo $SERVICE)"
SERV_NAME="$(head -1 $TMPFILE <<<"$info" | sed -e 's/ $//')"
...
From man ksh:
<<<word A short form of here document in which word becomes the
contents of the here-document after any parameter expan-
sion, command substitution, and arithmetic substitution
occur.
Advantages include:
- Enables parallel execution.
- In my experience this is tons faster than temporary files. Unless you have so much data that you end up swapping it should be orders of magnitude faster (only barring HD caching buffers, which might be about as quick for small data amounts).
- Other processes or users can't mess up your data.