PYROS 762 Bytes
#!/usr/bin/env bash

# test if user passed a command as parameter
if test $# -lt 1
then
    echo "Missing command, use one of the commands below"
    python3 pyros.py --help
    exit 1
fi

# test if docker is installed 
if [ $(docker -v | echo $?) -eq 0 ];
then
    docker=true
else
    docker=false
fi

if $docker
then
    # test if container is running
    if ! [ $(docker ps | grep 'pyros' | wc -l) -eq 2 ];
    then
        container=true;
    else
        container=false;
    fi
    if $container;
    then
        docker exec -it pyros python3 pyros.py $1
    else
        # starting container first and then launch pyros.py
        cd docker; docker-compose up -d
        docker exec -it pyros python3 pyros.py $1
    fi
else
    python3 pyros.py $1
fi