Macro sh_inline::bash

source ·
macro_rules! bash {
    ($s:expr) => { ... };
    ($s:expr, $( $id:ident = $v:expr ),*) => { ... };
    ($s:expr, $( $id:ident ),*) => { ... };
}
Expand description

Execute a fragment of Bash shell script, returning an error if the subprocess exits unsuccessfully. This is intended as a convenience macro for the common case of wanting to just propagate errors. The returned error type is std::io::Error.

For more details on usage, see the bash_command macro.

use sh_inline::*;
let a = "foo";
let b = std::path::Path::new("bar");
bash!(r#"test "${a} ${b} ${c}" = "foo bar 42""#, a = a, b = b, c = 42)?;