test-lib: add in-shell "env" replacement