executes a shell command and returns its output as a string
sollya_obj_t sollya_lib_bashevaluate(sollya_obj_t, ...)
sollya_obj_t sollya_lib_v_bashevaluate(sollya_obj_t, va_list)
- command is a command to be interpreted by the shell.
- input is an optional character sequence to be fed to the command.
- bashevaluate(command) will execute the shell command command in a shell.
All output on the command's standard output is collected and returned
as a character sequence.
- If an additional argument input is given in a call to
bashevaluate(command,input), this character sequence is written to the
standard input of the command command that gets executed.
- All characters output by command are included in the character
sequence to which bashevaluate evaluates but two exceptions. Every NULL
character ('\0') in the output is replaced with
'?' as Sollya is unable to handle character sequences containing that
character. Additionally, if the output ends in a newline character
('\n'), this character is stripped off. Other
newline characters which are not at the end of the output are left as
Go back to the list of commands
> bashevaluate("LANG=C date");
Mon Oct 17 09:39:55 CEST 2016
> [| bashevaluate("echo Hello") |];
> a = bashevaluate("sed -e 's/a/e/g;'", "Hallo");