Macro sh_inline::bash_in

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

Execute a fragment of Bash shell script with the specified working directory.

Otherwise this is equivalent to the bash macro.

use sh_inline::*;
use std::sync::Arc;
let td = Arc::new(cap_tempfile::tempdir(cap_std::ambient_authority())?);
td.write("sometestfile", "test file contents")?;
bash_in!(td, r#"grep -qF "test file contents" sometestfile"#)?;