Node:Passing Commands to the OS, Next:, Previous:Threading Words, Up:Words



Passing Commands to the Operating System

Gforth allows you to pass an arbitrary string to the host operating system shell (if such a thing exists) for execution.

sh       "..." --         gforth       ``sh''
Parse a string and use system to pass it to the host operating system for execution in a sub-shell.
system       c-addr u --         gforth       ``system''
Pass the string specified by c-addr u to the host operating system for execution in a sub-shell.
$?       -- n         gforth       ``dollar-question''
Value - the exit status returned by the most recently executed system command.
getenv       c-addr1 u1 -- c-addr2 u2        gforth       ``getenv''
The string c-addr1 u1 specifies an environment variable. The string c-addr2 u2 is the host operating system's expansion of that environment variable. If the environment variable does not exist, c-addr2 u2 specifies a string 0 characters in length.