Get system command output: Difference between revisions
Content added Content deleted
m (used singular form in task preamble.) |
Walterpachl (talk | contribs) (→{{header|ooRexx}}: added 2 other versions) |
||
Line 374: | Line 374: | ||
=={{header|ooRexx}}== |
=={{header|ooRexx}}== |
||
===version 1=== |
|||
<lang ooRexx>/* Execute a system command and retrieve its output into a stem. */ |
<lang ooRexx>/* Execute a system command and retrieve its output into a stem. */ |
||
trace normal |
trace normal |
||
Line 401: | Line 402: | ||
/* Exit with the system command's return code. */ |
/* Exit with the system command's return code. */ |
||
exit ls_rc</lang> |
exit ls_rc</lang> |
||
===version 2=== |
|||
<lang oorexx>cmd='dir tu*.rex /od' |
|||
cmd '| rxqueue' |
|||
Say 'Output of "'cmd'"' |
|||
Say |
|||
Do While queued()>0 |
|||
parse pull text |
|||
Say text |
|||
End </lang> |
|||
{{out}} |
|||
<pre>Output of "dir tu*.rex /od" |
|||
Datenträger in Laufwerk I: ist USB DISK |
|||
Volumeseriennummer: 5D55-13AC |
|||
Verzeichnis von I:\ |
|||
31.08.2016 19:36 1.358 turing.rex |
|||
31.08.2016 19:49 1.398 turing2.rex |
|||
2 Datei(en), 2.756 Bytes |
|||
0 Verzeichnis(se), 3.357.933.568 Bytes frei </pre> |
|||
===version 3=== |
|||
<lang oorexx>dir='dir.dir' |
|||
cmd='dir t*.rex /od' |
|||
cmd '>'dir |
|||
'dir tu*.rex /od >'dir |
|||
Say 'Output of "'cmd'"' |
|||
Say |
|||
Do While lines(dir)>0 |
|||
Say linein(dir) |
|||
End |
|||
Call lineout oid</lang> |
|||
{{out}} |
|||
<pre>identical to version 2's output</pre> |
|||
=={{header|PARI/GP}}== |
=={{header|PARI/GP}}== |