'How to run multiple Linux command line statements from SAS synchronously, with piped response?

I can run:

filename my_com pipe "sleep 60s";
data _null_; file my_com; run;

And the log shows a full 60 second wait:

enter image description here

But if I run:

filename my_com pipe "echo ""hello"" & sleep 60s & echo ""goodbye""";
data _null_; file my_com; run;

The log shows the execution of my 1st and 3rd commands, without the interim 60 second wait. Is there another way to run this so that each command line command runs synchronously (and to completion), while piping the response back to the SAS log?

enter image description here



Solution 1:[1]

replace & with ;

filename my_com pipe "echo ""hello"" ; sleep 60s ; echo ""goodbye""";
data _null_; file my_com; run; 

I have not used FILE and PIPE and did not realize that it works, sort of. I would have done it this way.

52         filename my_com pipe "echo ""hello"" ; sleep 60s ; echo ""goodbye""";
53         data _null_;
54            infile my_com;
55            input;
56            put _infile_;
57            run;

NOTE: The infile MY_COM is:
      Pipe command="echo "hello" ; sleep 60s ; echo "goodbye""

hello
goodbye
NOTE: 2 records were read from the infile MY_COM.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1