title: Shell variable value passing to subshell?
body: <p>I am writing script in shell and it's something like:</p>
  
  <pre><code>temp=0
  while true; do
      case "a" in
          a) temp=5; ;;
      esac
      break
  done | echo "$temp"
  </code></pre>
  
  <p>( temp value is condition for if in subshell and | (pipe) is needed as stdout redirect to stdin)
  and I need in temp 5 but I got 0 in echo. Any way to preserve value inside case (posixly correct without tempfile)?</p>