Manage starting point in shell script.
Hi,
I'd like to run a script with an optional starting point.
Meaning that if no parameter for the script => Do everything, otherwise start from the point specified in the parameter and continue till the end.
I thought of using the "case ..." but I have no result.
Script:
# ---------------
START_POINT=$1
if [ "$START_POINT" = "" ]
then
START_POINT="a"
fi
echo ">$START_POINT<"
case $START_POINT in
"a") echo "Running >a<!";;
"b") echo "Running >b<!";;
"c") echo "Running >c<!";;
"d") echo "Running >d<!";;
default) echo "Wrong value for starting point";;
esac
return
# ---------------
result expected:
> script [nothing]
Running >a<!
Running >b<!
Running >c<!
Running >d<!
> script c
Running >c<!
Running >d<!
> script k
Wrong value for starting point
Please provide some help.
Thanks in advance.
Regards!
|