Execute a system command: Difference between revisions

Rename Perl 6 -> Raku, alphabetize, minor clean-up
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
Line 243:
=={{header|AppleScript}}==
<lang applescript>do shell script "ls" without altering line endings</lang>
 
=={{header|Applesoft BASIC}}==
<lang ApplesoftBASIC>? CHR$(4)"CATALOG"</lang>
Line 334 ⟶ 335:
return 0;
}</lang>
 
=={{header|C++}}==
{{works with|Visual C++|2005}}
<lang cpp>system("pause");</lang>
 
=={{header|C sharp|C#}}==
Line 365 ⟶ 362:
}
}</lang>
 
=={{header|C++}}==
{{works with|Visual C++|2005}}
<lang cpp>system("pause");</lang>
 
=={{header|Clojure}}==
 
Line 471 ⟶ 473:
=={{header|dc}}==
<lang dc>! ls</lang>
 
=={{header|DCL}}==
<lang DCL>Directory</lang>
Line 702 ⟶ 705:
...
</pre>
 
=={{header|gnuplot}}==
 
<lang gnuplot>!ls</lang>
 
=={{header|Go}}==
Line 720 ⟶ 727:
}
}</lang>
 
=={{header|gnuplot}}==
 
<lang gnuplot>!ls</lang>
 
=={{header|Groovy}}==
Line 767 ⟶ 770:
pid := system(command_string,&input,&output,&errout,"nowait")
</lang>
 
=={{header|IDL}}==
<lang idl>$ls</lang>
Line 1,023 ⟶ 1,027:
> (io:format (os:cmd "ls -alrt"))
</lang>
 
 
=={{header|Liberty BASIC}}==
Line 1,030 ⟶ 1,033:
run "cmd.exe /";drive1$;" dir & pause"
</lang>
 
=={{header|Lingo}}==
{{libheader|Shell Xtra}}
<lang lingo>sx = xtra("Shell").new()
if the platform contains "win" then
put sx.shell_cmd("dir")
else
put sx.shell_cmd("ls")
end if</lang>
 
=={{header|Limbo}}==
Line 1,072 ⟶ 1,066:
 
It's not strictly necessary to pass the graphics context to ls, but it is generally a good idea to do so when calling another program.
 
=={{header|Lingo}}==
{{libheader|Shell Xtra}}
<lang lingo>sx = xtra("Shell").new()
if the platform contains "win" then
put sx.shell_cmd("dir")
else
put sx.shell_cmd("ls")
end if</lang>
 
=={{header|Locomotive Basic}}==
Line 1,206 ⟶ 1,209:
M3toC.FreeCopiedS(command);
END Exec.</lang>
 
=={{header|MUMPS}}==
<p>ANSI MUMPS doesn't allow access to the operating system except possibly through the View command and $View function, both of which are implementation specific. Intersystems' Caché does allow you to create processes with the $ZF function, and if the permissions for the Caché process allow it you can perform operating system commands.</p>
Line 1,368 ⟶ 1,372:
ExecuteProcess('/bin/ls', '-alh');
end.</lang>
 
=={{header|Perl}}==
<lang perl>my @results = qx(ls); # run command and return STDOUT as a string
 
my @results = `ls`; # same, alternative syntax
 
system "ls"; # run command and return exit status; STDOUT of command goes program STDOUT
 
print `ls`; # same, but with back quotes
 
exec "ls"; # replace current process with another</lang>
 
See also:
http://perldoc.perl.org/perlipc.html#Using-open()-for-IPC
http://perldoc.perl.org/IPC/Open3.html
 
=={{header|Perl 6}}==
<lang perl6>run "ls" orelse .die; # output to stdout
 
my @ls = qx/ls/; # output to variable
 
my $cmd = 'ls';
@ls = qqx/$cmd/; # same thing with interpolation</lang>
 
=={{header|PDP-11 Assembly}}==
Line 1,457 ⟶ 1,438:
...
.cmd_ls EQUS "ls",0</lang>
 
=={{header|Perl}}==
<lang perl>my @results = qx(ls); # run command and return STDOUT as a string
 
my @results = `ls`; # same, alternative syntax
 
system "ls"; # run command and return exit status; STDOUT of command goes program STDOUT
 
print `ls`; # same, but with back quotes
 
exec "ls"; # replace current process with another</lang>
 
See also:
http://perldoc.perl.org/perlipc.html#Using-open()-for-IPC
http://perldoc.perl.org/IPC/Open3.html
 
=={{header|Phix}}==
Line 1,520 ⟶ 1,516:
{{works with|GNU Prolog}}
<lang prolog>shell('ls').</lang>
 
=={{header|PureBasic}}==
<lang PureBasic>ImportC "msvcrt.lib"
Line 1,584 ⟶ 1,581:
(system* (find-executable-path "/bin/ls") "-l")
</lang>
 
=={{header|Perl 6Raku}}==
(formerly Perl 6)
<lang perl6>run "ls" orelse .die; # output to stdout
 
my @ls = qx/ls/; # output to variable
 
my $cmd = 'ls';
@ls = qqx/$cmd/; # same thing with interpolation</lang>
 
=={{header|Raven}}==
Line 1,715 ⟶ 1,721:
 
<lang smalltalk>Smalltalk system: 'ls'.</lang>
 
=={{header|Standard ML}}==
Just run the command:
 
<lang sml>OS.Process.system "ls"</lang>
 
=={{header|SQL PL}}==
Line 1,745 ⟶ 1,746:
!dir
</lang>
 
=={{header|Standard ML}}==
Just run the command:
 
<lang sml>OS.Process.system "ls"</lang>
 
=={{header|Stata}}==
Line 1,992 ⟶ 1,998:
End Module
</lang>
 
=={{header|Wart}}==
<lang wart>system "ls"</lang>
10,327

edits