#!/bin/sh error() { echo "$@" 1>&2; } fail() { [ $# -eq 0 ] || error "$@"; exit 1; } Usage() { cat <&2; exit 1; } [ "$1" = "-h" -o "$1" = "--help" ] && { Usage; exit 0; } env="$1" shift tox_d="${0%/*}/../.tox" activate="$tox_d/$env/bin/activate" [ -d "$tox_d" ] || fail "$tox_d: not a dir. maybe run 'tox'?" [ "$env" = "-l" -o "$env" = "--list" ] && { list_toxes ; exit ; } if [ ! -f "$activate" ]; then error "$env: not a valid tox environment?" error "try one of:" list_toxes "$tox_d" " " fail fi . "$activate" [ "$#" -gt 0 ] || set -- ${SHELL:-/bin/bash} debian_chroot="tox:$env" exec "$@"