#!/bin/sh
#
# vex - run a command and print a string to stdout showing pass/fail
#
# vex runs the command given in its arguments, and prints "true" or "false" as
# the last line of stdout based on the command's exit value.
# The exit value is the same as the command wrapped.
#
# Usage:
#      vex true
#      vex test ‐f /foo/bar/baz

if [ "$#" -eq 0 ]; then
  printf >&2 'vex: Need a command\n'
  exit 2
fi
"$@"
ex=$?
case ${ex} in
  0) op='true' ;;
  *) op='false' ;;
esac
printf '%s\n' "${op}"
exit "${ex}"
