#!/bin/sh
set -eu

if [ $# -lt 1 ]; then
	echo "Usage: $(basename $0) <init|input|..> [..]"
	exit 1
fi

# merge arguments into '/'-joined string
OIFS=$IFS
IFS='/'
CMD="/etc/audio-config/$*"
IFS=$OIFS

# execute sub-script if possible
if [ -f $CMD -a -x $CMD ]; then
	$CMD
else
	echo "Error: no such command: $*" 1>&2
	exit 1
fi
