-
-
Notifications
You must be signed in to change notification settings - Fork 163
Migration Guide
(work in progress)
NEWER: Gradually Upgrading Shell to YSH (TODO: Consolidate these)
If you have a big repo of shell scripts, a quick and easy test for "smoke test" for compatibility is:
find . -name '*.sh' | xargs -- osh -n
This will attempt to parse all the files. (TODO: handle failure, etc.)
osh
behaves like any other shell, so this is as simple as
osh myscript.sh
If you want more errors out of OSH, put this at the top of your shell scripts:
shopt -s strict:all
To remain compatible with other shells, suppress stderr and ignore failure if this option doesn't exist:
shopt -s strict:all 2>/dev/null || true
In some settings, you can just change your shebang lines from #!/bin/bash
to #!/usr/bin/env osh
, and "see what happens".
In other settings, you might want to write tests first. Then run the tests with both bash and osh.
I filed issue #297 Runs the bats test framework because bats appears to be pretty popular. (Although I'd also like OSH to have some simpler test framework builtin. That is, some simple "batteries" should be included.)
Start a thread on #oil-discuss
on https://oilshell.zulipchat.com/ (log in with Github).