#!/bin/bash python_cmd='python3' # Fallback to Python 2, if Python 3 is not available command -v python3 > /dev/null || python_cmd=`python` BASEDIR=$(dirname $0) ID=$(id -u) # Avoid using sudo if we're already root SUDO=sudo if [ $ID -eq 0 ] then SUDO="" fi $SUDO $python_cmd -u $BASEDIR/sensehat.py $@