Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • I find this confusing. (1) Answers are a WHOLE lot more readable when they use the same naming convention as the question.  It appears that you have renamed “command1” → “othercommand”, “command2” → “command1”, and “command3” → “command2”.  And yet you also have a “command3”, so clearly I’m not understanding you. (2) The question requests that there be no temporary files, and yet you clearly have some.  ISTM that this exercise is easy if you’re allowed to use temporary files.  … (Cont’d) Commented Mar 24, 2022 at 10:17
  • (Cont’d) …  (3) The question wants output into two variables.  Getting back to my point 1, I see no var2 and var3 — have you renamed them to results1 and results2?  Are you assuming that each command will produce exactly one line of output?  (4) Again getting back to my point 1, what is command3?  What is combinedresult.txt?  The question does not call for an output file.  Why are you trying to “combine the outputs on the return value”?  … (Cont’d) Commented Mar 24, 2022 at 10:17
  • (Cont’d) …  (5) You clearly have not copied-and-pasted this from a tested, working solution, because the third line (the one with the tee) has unbalanced quotes.  I’ll admit that I have rushed to post an answer to a new question in hopes of being the first to do so.  Rushing to post an untested answer to a three-year-old question is poor form. (6) At the risk of nit-picking, why are you using >> instead of >? Commented Mar 24, 2022 at 10:17
  • ah, I apologize was written on my break at work on cellphone updating now, I was working under the assumption that the output was meant to be saved (as in logs) however if you look at the command the variables are not set using temporary files but are set by the values of the output of the co process commands called through their array. Commented Mar 26, 2022 at 4:30
  • However I use the >> instead of the > because co-process runs in a stream it reevaluates every time you feed it information and if you log your command out put (which i generally default too). Which is why i didn't consider them temporarily files as they a. aren't what sets the variable and b. aren't intended to be destroyed. I'm of work in in an hour and will write up better articulated solution. Commented Mar 26, 2022 at 4:43