Known Limitations
fortsh has some limitations compared to bash and other shells.
Platform Limitations
macOS Apple Silicon (M1/M2/M3/M4)
The C string library (enabled by default) works around flang-new's 128-byte substring bug. With it enabled, the command line limit is 1024 characters. On Linux, editing buffers are fully allocatable with no hard limit.
History is capped at 100 entries (vs 1000 on Linux).
See macOS Apple Silicon for details.
macOS Intel
No significant limitations. Full functionality available.
Linux
No significant limitations. This is the primary development platform.
Feature Limitations
Nested Brace Expansion
Complex nested brace expansions may not work:
# Works
echo {a,b}{1,2} # a1 a2 b1 b2
# May not work
echo {{a,b},{c,d}} # Nested braces
Vi Mode Gaps
Vi editing mode is functional but incomplete compared to bash:
- Some vi commands not implemented
- Some movement commands may differ
- Visual mode not supported
Arithmetic Precision
Shell arithmetic uses Fortran integers:
echo $((2**62)) # Works
echo $((2**63)) # May overflow
For arbitrary precision, use external tools like bc.
Process Substitution
Process substitution is supported but may have edge cases:
diff <(cmd1) <(cmd2) # Works
Coprocess
Coprocess support was added in v1.2.0. Basic usage works:
coproc myproc { cmd; } # Supported
See coproc for details.
Compatibility Notes
Bash Compatibility
fortsh aims for ~99% bash compatibility. Known differences:
| Feature | fortsh | bash |
|---|---|---|
[[ test | Supported | Supported |
| Arrays | Supported | Supported |
| Associative arrays | 50 entry limit | Unlimited |
| Brace expansion | Basic | Full nested |
| Process substitution | Supported | Supported |
| Coprocess | Supported (since v1.2.0) | Supported |
| Loadable builtins | Not supported | Supported |
POSIX Compliance
fortsh passes POSIX compliance tests (3,776 tests). Some extensions may differ from strict POSIX.
shopt Options
Not all bash shopt options are supported:
# Supported
shopt -s nullglob
shopt -s extglob
# May not be supported
shopt -s globstar # Check documentation
Resource Limits
Maximum Values
| Resource | Linux / Intel Mac | ARM Mac (with C strings) |
|---|---|---|
| Command line length | No hard limit (allocatable buffers) | 1024 characters |
| Token length | 4096 characters | 4096 characters |
| Autosuggestion / history entry | 1024 characters | 1024 characters |
| History entries | 1000 (memory) | 100 (memory) |
| Associative array entries | 50 per array | 50 per array |
| Environment variable value | 32768 characters | 32768 characters |
| Heredoc size | 65536 characters | 65536 characters |
| Max tokens per command | 500 | 500 |
Performance
fortsh may be slower than bash on:
- Very large scripts (thousands of lines)
- Heavy process spawning
- Complex string manipulation
For most interactive use and moderate scripts, performance is comparable.
Reporting Issues
If you encounter a limitation that should be fixed:
- Check if it's a known issue on GitHub
- Open an issue with a minimal reproduction case
- Include:
- fortsh version (
fortsh --version) - Platform (
uname -a) - Expected vs actual behavior
- fortsh version (
GitHub: github.com/fortrangoingonforty/fortsh/issues
Future Improvements
Planned improvements:
- Increased associative array limits
- More vi mode commands
- Better nested brace expansion
The project welcomes contributions for any of these areas.