Sounds like a job for Ant-Contrib's <propertyregex>. Or assuming you use JDK
1.4.*, a <script> using java.util.regex. --DD

> -----Original Message-----
> From: Ken Gentle [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, September 09, 2003 3:25 PM
> To: [EMAIL PROTECTED]
> Subject: Convert Bash Script to equivalent Ant tasks?
> 
> Does anyone have any suggestions for converting the following bash script
> to an equivalent set of ANT Targets?
> 
> The basic idea is to take a path of the form
> 
>       ./QA/3.04.10-01/dist/Scripts/zz-Post-Install.sql
> 
> and turn it into
> 
>       ./PROD/3.04.10/dist/Scripts/01-zz-Post-Install.sql
> 
> I'm heading down the path of a <copy> with a regexp mapper.  Are there
> better alternatives?
> 
> Thanks!
> 
>       Ken
> 
> 
> #/usr/bin/bash
> #
> # Current directory should contain two directory structures:
> #   QA/
> #      3.04.10-01
> #      3.04.10-02
> #      3.04.10-03
> #      .
> #      .
> #      .
> #      3.04.10-99
> #   PROD/
> #      3.04.10
> #
> #
> 
> # Release Id is of the form 3.04.10 (Major/Minor/Patch)
> RELEASE_ID=${1}
> #
> if [ "" = "${RELEASE_ID}" ]
> then
>    echo No release number specified.
>    exit 1
> fi
> # QA Releases are identified by the Release Id followed by a hyphen and
> the
> # build number:  3.04.10-01
> #
> # PROD Releases are identified by the Release Id only.
> #
> # We want to move the scripts from each QA Release, in order, to the PROD
> # tree, prefixing each script with its build number. For Example
> #
> #   QA/3.04.10-01/dist/Scripts/zz-Post-Install.sql
> #   QA/3.04.10-02/dist/Scripts/zz-Post-Install.sql
> #
> # becomes
> #
> #   PROD/3.04.10/dist/Scripts/01-zz-Post-Install.sql
> #   PROD/3.04.10/dist/Scripts/02-zz-Post-Install.sql
> #
> for REL in QA/${RELEASE_ID}-??
> do
>    # Start with QA/3.04.10-01
>    t=${REL%*-[0-9][0-9]}   # Get everything but build: QA/3.04.10
>    QA_NUM=${REL#${t}-}     # Get the build number:  01
>    echo $REL - QA Release $QA_NUM
>    echo Release Directory is $REL
>    for SCR in ${REL}/dist/Scripts/*
>    do
>      FNAME=$(basename "${SCR}")
>      if [ "${FNAME}" != "vssver.scc" ]
>      then
>        cp "${SCR}" "PROD/${RELEASE_ID}/dist/Scripts/${QA_NUM}-${FNAME}"
>      fi
>    done
> done
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to