9/03/2011

Adding system commands

Change brings opportunity.
-Nido Qubein

Yesterday, I received an interesting question from rambler on this blog. He asked if TBS supports system calls. I had to answer no, because I forgot to add them...


However, in TBS alpha-2 system commands will be available with a new system function called "system". This function returns the output of a command you give as an argument. As an example, I ran the following script:
!out(~!system(~"whereis tbs"));
_die();
And I got the following output(as expected):
tbs: /usr/bin/tbs
And, as you probably would expect, the following:
!out(~!system(~"sudo gedit"));
_die();

Asks for the password for sudo and then runs gedit as root. So that works.

2 comments:

  1. Actually, that's not what I meant, although this addition is important. :p

    http://en.wikipedia.org/wiki/System_call

    ReplyDelete
  2. @rambler Oh I see, forgive me. I was thinking about system commands as in C using system().

    ReplyDelete