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*

8
  • OK, but now I don't have the stdout of the ls, and I need that. Commented Jan 28, 2017 at 21:44
  • @PatrickKusebauch Does your ssh connection produce error simultaneously with ls producing output ? If not, what's going to be stored in the variable is either ssh's stderr or ls's stdout Commented Jan 28, 2017 at 21:46
  • OK, how do I differentiate then? Commented Jan 28, 2017 at 21:48
  • @PatrickKusebauch You could check $? variable. If there was an error, it would be equal to non-zero value. I'll add example in a moment. Commented Jan 28, 2017 at 21:50
  • $? will also be non-zero if the ls fails. Commented Jan 28, 2017 at 22:03