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 Oct 14 12:15:54 CEST 2013
Example 2:
> [| bashevaluate("echo Hello") |];
[|"Hello"|]
Example 3:
> a = bashevaluate("sed -e 's/a/e/g;'", "Hallo");
> a;
Hello