A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
|
|
@ -0,0 +1 @@
|
|||
"ls" run-process wait-for-process
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
class Main
|
||||
{
|
||||
public static Void main ()
|
||||
{
|
||||
p := Process (["ls"])
|
||||
p.run
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
Start,Programs,Accessories,MSDOS Prompt,Type:dir[enter]
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
SYSTEM(CoMmand='pause')
|
||||
SYSTEM(CoMmand='dir & pause')
|
||||
|
|
@ -0,0 +1 @@
|
|||
$ls
|
||||
|
|
@ -0,0 +1 @@
|
|||
spawn,"ls",result
|
||||
|
|
@ -0,0 +1 @@
|
|||
spawn,"ls",unit=unit
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
procedure main()
|
||||
|
||||
write("Trying command ",cmd := if &features == "UNIX" then "ls" else "dir")
|
||||
system(cmd)
|
||||
|
||||
end
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
pid := system(command_string,&input,&output,&errout,"wait")
|
||||
pid := system(command_string,&input,&output,&errout,"nowait")
|
||||
|
|
@ -0,0 +1 @@
|
|||
System runCommand("ls") stdout println
|
||||
15
Task/Execute-a-system-command/J/execute-a-system-command.j
Normal file
15
Task/Execute-a-system-command/J/execute-a-system-command.j
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
load'task'
|
||||
|
||||
NB. Execute a command and wait for it to complete
|
||||
shell 'dir'
|
||||
|
||||
NB. Execute a command but don't wait for it to complete
|
||||
fork 'notepad'
|
||||
|
||||
NB. Execute a command and capture its stdout
|
||||
stdout =: shell 'dir'
|
||||
|
||||
NB. Execute a command, provide it with stdin,
|
||||
NB. and capture its stdout
|
||||
stdin =: 'blahblahblah'
|
||||
stdout =: stdin spawn 'grep blah'
|
||||
|
|
@ -0,0 +1 @@
|
|||
"ls" system.
|
||||
|
|
@ -0,0 +1 @@
|
|||
\ls
|
||||
|
|
@ -0,0 +1 @@
|
|||
r: 4:"ls"
|
||||
|
|
@ -0,0 +1 @@
|
|||
'ls system
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
drive1$ = left$(Drives$,1)
|
||||
run "cmd.exe /";drive1$;" dir & pause"
|
||||
|
|
@ -0,0 +1 @@
|
|||
LIST
|
||||
|
|
@ -0,0 +1 @@
|
|||
print first butfirst shell [ls -a] ; ..
|
||||
|
|
@ -0,0 +1 @@
|
|||
syscmd(ifdef(`__windows__',`dir',`ls'))
|
||||
|
|
@ -0,0 +1 @@
|
|||
dosCommand "pause"
|
||||
|
|
@ -0,0 +1 @@
|
|||
Set X=$ZF(-1,"DIR")
|
||||
|
|
@ -0,0 +1 @@
|
|||
ZSY "DIR"
|
||||
|
|
@ -0,0 +1 @@
|
|||
ZSY "ls"
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
contents=$(shell cat foo)
|
||||
curdir=`pwd`
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
mytarget:
|
||||
cat foo | grep mytext
|
||||
|
|
@ -0,0 +1 @@
|
|||
Run["ls"]
|
||||
|
|
@ -0,0 +1 @@
|
|||
system("dir > list.txt")$
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
:- module execute_sys_cmd.
|
||||
:- interface.
|
||||
:- import_module io.
|
||||
|
||||
:- pred main(io::di, io::uo) is det.
|
||||
|
||||
:- implementation.
|
||||
|
||||
main(!IO) :-
|
||||
io.call_system("ls", _Result, !IO).
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
MODULE tri;
|
||||
|
||||
FROM SYSTEM IMPORT ADR;
|
||||
FROM SysLib IMPORT system;
|
||||
|
||||
IMPORT TextIO, InOut, ASCII;
|
||||
|
||||
VAR fd : TextIO.File;
|
||||
ch : CHAR;
|
||||
|
||||
PROCEDURE SystemCommand (VAR command : ARRAY OF CHAR) : BOOLEAN;
|
||||
|
||||
BEGIN
|
||||
IF system (ADR (command) ) = 0 THEN
|
||||
RETURN TRUE
|
||||
ELSE
|
||||
RETURN FALSE
|
||||
END
|
||||
END SystemCommand;
|
||||
|
||||
BEGIN
|
||||
IF SystemCommand ("ls -1 tri.mod | ") = TRUE THEN
|
||||
InOut.WriteString ("No error reported.")
|
||||
ELSE
|
||||
InOut.WriteString ("Error reported!")
|
||||
END;
|
||||
LOOP
|
||||
InOut.Read (ch);
|
||||
InOut.Write (ch);
|
||||
IF ch < ' ' THEN EXIT END
|
||||
END;
|
||||
InOut.WriteLn;
|
||||
InOut.WriteBf
|
||||
END tri.
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
UNSAFE MODULE Exec EXPORTS Main;
|
||||
|
||||
IMPORT Unix, M3toC;
|
||||
|
||||
VAR command := M3toC.CopyTtoS("ls");
|
||||
|
||||
BEGIN
|
||||
EVAL Unix.system(command);
|
||||
M3toC.FreeCopiedS(command);
|
||||
END Exec.
|
||||
Loading…
Add table
Add a link
Reference in a new issue