use bashkit::Bash;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let mut bash = Bash::new();
let result = bash.exec("echo 'Hello, Bashkit!'").await?;
println!("Output: {}", result.stdout);
let result = bash.exec("NAME=World; echo \"Hello, $NAME!\"").await?;
println!("Output: {}", result.stdout);
let result = bash
.exec("echo -e 'apple\\nbanana\\ncherry' | grep a")
.await?;
println!("Filtered: {}", result.stdout);
let result = bash
.exec("FILES=$(echo one two three); echo \"Files: $FILES\"")
.await?;
println!("Output: {}", result.stdout);
let result = bash.exec("echo \"2 + 2 = $((2 + 2))\"").await?;
println!("Output: {}", result.stdout);
let script = r#"
for fruit in apple banana cherry; do
echo "I like $fruit"
done
"#;
let result = bash.exec(script).await?;
println!("Loop output:\n{}", result.stdout);
Ok(())
}