[][src]Crate sh_inline

Macros to run commands/shell inline in Rust

In many cases it's convenient to run child processes, particularly via Unix shell script. However, there are some subtle things to get right in doing this, such as dealing with quoting issues.

use sh_inline::*;
let foo = "variable with spaces";
bash!("test {foo} = 'variable with spaces'", foo)?;

Macros

bash

Execute a fragment of Bash shell script, returning an error if the subprocess exits unsuccessfully. This is intended as a convenience function; if for example you might want to change behavior based on specific exit codes, it's recommended to use bash_command() instead.

bash_command

Create a Command object that will execute a fragment of (Bash) shell script in "strict mode", i.e. with set -euo pipefail. The script will be substituted similarly to format!.