Crosh is a minimal Bash-like language for cross-platform scripting on Windows, macOS, and Linux. The goal is to cover up some of the major differences between PowerShell and Bash like behavior of mv, cp, basic file manipulation, environment variables, and basic control flow.
Fundementally though, it must be similar enough to Bash that it's not easier to go learn a foreign cross-platform shell like Xonsh, Nushell, or scsh. Though all of these are more mature and good choices, they require more investment to learn them since they are less Bash-like.
- Support all of the Bash spec
- Be completely identical when cloning Linux userland programs like mv, cp
- Job control
- Pipes
- Complex expressions (array manipulation, string manipulation, arithmetic, etc.)
Since it is new, it should be considered unsafe for anything but containerized build environments where it doesn't matter so much if the language implementation has bugs.
This adds X=1
to the environment variables passed to any execututions called.
Arguments can be addressed like in Bash: $0
, $1
... $N
.
All arguments excluding $0
.
Returns the command line argument following the flag.
Returns true if the flag exists in command line arguments.
Returns the environment variable value or empty string if it is not set.
Returns true if the environment variable has been set.
This modifies the file, adding the prefix string.
This modifies the file, adding the suffix string.