Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Shell
#1
Quick question. Does N7 possess the ability to issue system shell commands? I could not find any reference in 'The Manual'...

J
Logic is the beginning of wisdom.
Reply
#2
Perhaps these examples may help you ....

Example 1
Code:
' system
' ------

' 'system cmd' executes a system command.
system "dir"

' This executes the system command 'pause', which waits for the user to press any key.
system "pause"

' Clear the console window
system "cls"

' If called in an expression, 'system' returns the output of the command instead of printing it
' to the console window.
result = system("dir")

' Print the first line.
pln "First line: " + split(result, chr(10))[0]
pln

system "pause"


Example 2
Code:
' 'system' works as in n6, but can also be used in an expression to capture the
' output instead of sending it to stdout.

' This probably doesn't work on Linux.
result = system("dir /b /a-d")
pln "Press enter to see the captured result!"
a = rln()
pln result

pln "Press enter to see it again!"
a = rln()
system "dir /b /a-d"

pln
pln "Press enter to exit"
tmp = rln()

Example 3 [ Edited ]
unzip [starwars.zip] and compile [starwars.n7]

Example 4
unzip [Shell.zip] and compile [game.n7]


Attached Files
.zip   Shell.zip (Size: 1.7 KB / Downloads: 2)
.zip   starwars.zip (Size: 2.06 KB / Downloads: 1)
Reply
#3
Nice example!
Reply
#4
"System"... Cool... thanks for the examples. Much appreciated.
Logic is the beginning of wisdom.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)