I'm trying to pipe output from echo into a command using GLib's spawn_command_line_sync method. The problem I've run into is echo is interpreting the entire command as the argument.

To better explain, I run this in my code:

string command = "echo \"" + some_var + "\" | command"; Process.spawn_command_line_sync (command.escape (), out r, out e, out s);

I would expect the variable to be echoed to the pipe and the command run with the data piped, however when I check on the result it's just echoing everything after echo like this:

"some_var's value" | command