You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.)
Run your scripts
osh behaves like any other shell, so this is as simple as
osh myscript.sh
Enable Strict Mode
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
Do You Have Tests?
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.)