From 3fec0d67bbc82409a3cbc29072548560c7379cb2 Mon Sep 17 00:00:00 2001 From: Camille Scholtz Date: Mon, 27 Oct 2025 14:48:41 +0100 Subject: [PATCH] Conditionally add shopt for supported shells Add conditional shopt command for bash and zsh shells --- src/main.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 5a4a22e..c994d91 100644 --- a/src/main.rs +++ b/src/main.rs @@ -197,7 +197,15 @@ fn run_command(command: &str, shell: &str) -> Result<()> { anyhow::bail!("Invalid shell configuration"); } - let command = format!("shopt -s extglob globstar nullglob\n{command}"); + let shell_name = shell_parts.last().unwrap(); + + // Only add shopt for bash and zsh (which support it) + // Fish, sh, and other shells don't support shopt + let command = if shell_name.contains("bash") || shell_name.contains("zsh") { + format!("shopt -s extglob globstar nullglob\n{command}") + } else { + command.to_string() + }; let status = if shell_parts.len() == 1 { Command::new(shell_parts[0])