Anonymous user
Execute a system command: Difference between revisions
→{{header|AWK}}
(add AutoIt) |
|||
Line 108:
=={{header|AWK}}==
Using system() function:
<lang awk>BEGIN {
system("ls") # Unix
#system("dir") # DOS/MS-Windows
}</lang>
Using getline command:
<lang awk>BEGIN {
ls = sys2var("ls")
print ls
}
function sys2var(command ,fish, scale, ship) {
command = command " 2>/dev/null"
while ( (command | getline fish) > 0 ) {
if ( ++scale == 1 )
ship = fish
else
ship = ship "\n" fish
}
close(command)
return ship
}
=={{header|BASIC}}==
|