#!/bin/bash mypath="$( dirname $0 )" cmd="$mypath/showscene" getnext="$mypath/getval _scene" scene="$( $getnext )" if [ ! "$scene" ]; then scene='start' fi while [ "$scene" ]; do $cmd $scene # if the scene stated that we should end, then we should probably end if [ $? -eq 100 ]; then exit fi scene="$( $getnext )" done