command is a command to be interpreted by the shell.
input is an optional character sequence to be fed to the command.
Description:
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
such.
Example 1:
> bashevaluate("LANG=C date");
Mon Jun 13 18:50:08 CEST 2016
Example 2:
> [| bashevaluate("echo Hello") |];
[|"Hello"|]
Example 3:
> a = bashevaluate("sed -e 's/a/e/g;'", "Hallo");
> a;
Hello