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:

Featurefortshbash
[[ testSupportedSupported
ArraysSupportedSupported
Associative arrays50 entry limitUnlimited
Brace expansionBasicFull nested
Process substitutionSupportedSupported
CoprocessSupported (since v1.2.0)Supported
Loadable builtinsNot supportedSupported

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

ResourceLinux / Intel MacARM Mac (with C strings)
Command line lengthNo hard limit (allocatable buffers)1024 characters
Token length4096 characters4096 characters
Autosuggestion / history entry1024 characters1024 characters
History entries1000 (memory)100 (memory)
Associative array entries50 per array50 per array
Environment variable value32768 characters32768 characters
Heredoc size65536 characters65536 characters
Max tokens per command500500

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:

  1. Check if it's a known issue on GitHub
  2. Open an issue with a minimal reproduction case
  3. Include:
    • fortsh version (fortsh --version)
    • Platform (uname -a)
    • Expected vs actual behavior

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.