Skip to main content

split_shell_commands

Function split_shell_commands 

Source
pub fn split_shell_commands(command: &str) -> Vec<&str>
Expand description

Split a command string on shell compound operators (&&, ||, ;, |).

Returns each sub-command as a trimmed slice. Two-character operators (&&, ||) are matched before single-character ones (|, ;) so that || is not mis-parsed as two pipes.

Note: this does not handle quoting; operators inside quoted strings will cause harmless extra validation (safe direction: more checks, not fewer).