The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 08-28-2007
ai_dba ai_dba is offline
Registered User
  
 

Join Date: Sep 2005
Posts: 3
Unhappy 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!