-
-
Notifications
You must be signed in to change notification settings - Fork 163
How To Test OSH
This page accompanies the 0.6.pre15 release.
If anything on this page is unclear, or you can't get it to work, feel free to send a message on oilshell.zulipchat.com (log in with Github).
Also, feel free to edit the page with tips.
Run ./configure
, make
, sudo ./install
-- as described in the INSTALL.txt.
-
osh
behaves just like/bin/bash
:osh -c 'echo hi'
osh myscript.sh
- Or
source myprog.sh
within OSH. - etc.
- The startup file is
~/.config/oil/oshrc
- Make an
~/.oshrc
symlink if that gets annoying to type.
- Make an
- Our temporary fork of the bash-completion project has some required features: /~https://github.com/oilshell/bash-completion
(1) Run osh
with OSH_HIJACK_SHEBANG=<shell>
Example:
OSH_HIJACK_SHEBANG=$(which osh) osh -c 'echo hi; ./myscript.sh'
# Now myscript.sh will be excuted with OSH if its shebang looks like #!/bin/sh or #!/bin/bash.
(2) Run OSH with --debug-file FIFO
. The argument is a file to write log messages to. It's useful to make it a FIFO / named pipe.
In tmux, I open up a shell with --debug-file tmp/debug
on the LEFT, and a shell that cats the debug stream on the RIGHT.
Example:
$ mkfifo _tmp/debug # named pipe
$ osh --debug-file _tmp/debug # do this on the LEFT.
# You can also set -x and PS4='+$LINENO '
# Type commands here like 'source testdata/completion/git'.
$ cat _tmp/debug # do this on the RIGHT.
Also see Debugging Completion Scripts
- File issues on Github
- oilshell.zulipchat.com (log in with Github)
PS1='[osh] \h \w\$ ' # so I know I'm running OSH
oil_repo=~/git/oilshell/oil
# Load git completion plugin.
. $oil_repo/testdata/completion/git
# Load my bashrc, which I have patched. I use the absence of $BASH_VERSION to test for OSH.
. ~/.bashrc
The .bashrc
loads my own custom completions, which fall back on the temporary fork of bash-completion (URL above, branch dev/osh-release-0.6.pre15
):
Example:
. ~/git/oilshell/bash-completion/osh_completion` # this script is a modified version of bash_completion