|
|
. $SDEROOT/lib/libsde.in
# Determine the command to be used sdecommand=${0##*/}
# Check if the command is implemented if [ ! -d $SDEROOT/lib/$sdecommand ]; then echo_abort 1 "Command $sdecommand not yet implemented" fi
# Check descriminator itself. if [ -f "$SDEROOT/lib/$sdecommand/$1.in" ]; then discriminator="$1"; shift # Check if discriminator alias was used. elif grep -q "^#Alias: $1$" $SDEROOT/lib/$sdecommand/* 2> /dev/null; then # Use the alias by determining what descriptor the alias # belongs to. discriminator="$( grep -l "^#Alias: $1$" $SDEROOT/lib/$sdecommand/* 2> /dev/null | head -n 1 | sed -e 's,.*/,,' | sed -e 's,\.in,,' )" shift elif [ -f "$SDEROOT/lib/$sdecommand/default.in" ]; then # Command has a default handler, so use it. discriminator=default else # unknown command echo_error "Discriminator '$COLOR_INFO$1$COLOR_NORMAL' not understood." # revert back to help on the current command discriminator= fi
echo "Discriminator is: $discriminator"
. $SDEROOT/lib/$sdecommand/${discriminator}.in $@
|