Commit 0647757d authored by Juergen Nickelsen's avatar Juergen Nickelsen
Browse files

Bshell

parent 1d54ad8a
Loading
Loading
Loading
Loading
+13 −0
Original line number Original line Diff line number Diff line
@@ -20,6 +20,17 @@ use Interp;
# Builtins get their arguments directly as a Lisp list, have names
# Builtins get their arguments directly as a Lisp list, have names
# beginning with 'B', and are defined here (except for, well, exceptions)
# beginning with 'B', and are defined here (except for, well, exceptions)


sub Bshell {
        my ($command, $return_output) = checkargs($_[0], 'S:e');
        my $result;
        if (is_nil($return_output)) {
                $result = tornil(!system($command));
        } else {                
                $result = `$command`;
        }
        return $result;
}

sub Bread {
sub Bread {
        my ($input) = checkargs($_[0], ':S');
        my ($input) = checkargs($_[0], ':S');
        if (is_nil($input)) {
        if (is_nil($input)) {
@@ -984,6 +995,8 @@ my @builtins = # [name, func, is_special, doc]
      "return an expression read from stdin or &optional INPUT (a string)"],
      "return an expression read from stdin or &optional INPUT (a string)"],
     ["perl", \&Bperl, 0,
     ["perl", \&Bperl, 0,
      "evaluate the ARG string as Perl code and return the result"],
      "evaluate the ARG string as Perl code and return the result"],
     ["shell", \&Bshell,
      "run COMMAND as a shell command; &optional RETURN-OUTPUT"],
    );
    );


for my $b (@builtins) {
for my $b (@builtins) {