How to pass variables to shell script?

I have a shell script which uses the touch command to change the date of a file.  To run the command on the command line the syntax is:
set-file-date.sh <file> <date>
I'm trying to run it from an automator workflow, so I'm prompted for the date, then the workflow iterates over the finder items, i.e., files, and changes the date of each files.
The problem is in the "Run Shell Script" action.  The $@ is substituted with the file names selected in finder, so this will echo the file names:
for i in "$@"; do
     echo "$i"
done
What I want to do is something like this:
for i in "$@"; do
     set-file-date.sh <DATE VARIABLE> "$i"
done
But I can't prompt for the date value, and pass it to the script.  I've tried using the "Get Value of Variable" and the "Ask For Text" actions.  I can either get the file names from finder OR the text input in the "Ask for Text" action, but not both.
Is what I'm trying to do possible with a shell script?
-Thanks

This is standard AppleScript text concatenation...
set howManyWords to do shell script "wc -w /path/to/file | awk '{print $1}'"
do shell script "/usr/local/bin/growlnotify -t 'Corpus' -m '" & howManyWords & " words were added to the corpus.'"
in other words, just use the & to concatenate the parts of your text together.

Similar Messages

  • Passing variables from shell script to separate sqlplus script

    Hi, I am having issues passing variables to a separate sqlplus script invoked by the shell script, e.g.
    #!/bin/sh
    DB_NAME=TEST
    PWD1=PA55W0rd
    echo exit | sqlplus / as sysdba @${DB_NAME}.sql ${DB_NAME} $PWD1 >> ${DB_NAME}.sql
    exit 0
    The script picks up the $DB_NAME variable fine, and therefore invokes the required sql script.
    However, when I pass the variable $PWD1 to the sql script I get an error.
    The script creates a database link:
    create or replace procedure new.link
    is
    begin
    execute immediate 'create database link TEST
    connect to TESTSCH identified by '$PWD1'
    using ''TEST''';
    end;
    exec new.link;
    output is:
    ERROR at line 1:
    ORA-00911: invalid character
    ORA-06512: at "NEW.LINK", line 4
    ORA-06512: at line 1
    any help appreciated!
    Edited by: 969765 on Apr 5, 2013 4:24 AM

    969765 wrote:
    that is a pretty unhelpful comment, this is actually my LAST resort I have looked up all the documentation etc.This is what I did...
    I went to the documentation:
    http://www.oracle.com/pls/db112/homepage
    I searched for "sqlplus" which gave me this documentation (under "SQL*plus program syntax")...
    http://docs.oracle.com/cd/E11882_01/server.112/e16604/ch_three.htm#i1169374
    I read the syntax:
    SQLPLUS [ [Options] [Logon|/NOLOG] [Start] ]and the subsequent information:
    >
    where Start has the following syntax:
      @{url|file_name[.ext]} [arg ...]and "Start" was hyperlinked, so I clicked on it, which took me to the section...
    >
    Start
    @} [arg ...]
    Specifies the name of a script and arguments to run. The script can be called from the local file system or from a web server.
    SQL*Plus passes the arguments to the script as if executing the file using the SQL*Plus START command. If no file suffix (file extension) is specified, the suffix defined by the SET SUFFIX command is used. The default suffix is .sql.
    See the START command for more information.
    >
    and here the "START" was hyperlinked, so I clicked on that...
    and hey presto, I ended up here:
    http://docs.oracle.com/cd/E11882_01/server.112/e16604/ch_twelve044.htm#BACJJHDA
    ... where the arguments are described...
    >
    arg ...
    Data items you wish to pass to parameters in the script. If you enter one or more arguments, SQL*Plus substitutes the values into the parameters (&1, &2, and so forth) in the script. The first argument replaces each occurrence of &1, the second replaces each occurrence of &2, and so on.
    >
    ... clearly explaining that SQL*Plus substitutes the substitution variables &1, &2 etc. in the script with the passed in arguments.
    Your script was including a Unix style substitution, not an SQL*Plus script substitution, so that's seems to be the most likely cause of your problem.
    And still you haven't come back to say whether it's worked for you or not... leaving others guessing as to whether you still need help.

  • Issue passing variable into shell script

    Please see terminal session.
    -  calling pwd, unset, or echo alleviate the issue.
    - running the script 'plain' also exihibit an issue
    - calling 'cat test.sh' causes an issue
    I can repeat the issue on OSX 10.5.8
    On Ubuntu, two a's always print out with: A=a B=$A ./test.sh
    Terminal session:
    bash-3.2$ ls -l test.sh
    -rwxr-xr-x  1 axure  staff  16 Mar 29 09:27 test.sh
    bash-3.2$ cat test.sh
    echo $A
    echo $B
    bash-3.2$ pwd
    /Users/axure
    bash-3.2$ A=a B=$A ./test.sh
    a
    a
    bash-3.2$ A=a B=$A ./test.sh
    a
    bash-3.2$ $A
    bash-3.2$ $B
    bash-3.2$ echo $A
    bash-3.2$ echo $B
    bash-3.2$ unset
    bash-3.2$ A=a B=$A ./test.sh
    a
    a
    bash-3.2$ A=a B=$A ./test.sh
    a
    bash-3.2$ pwd
    /Users/axure
    bash-3.2$ A=a B=$A ./test.sh
    a
    a
    bash-3.2$ A=a B=$A ./test.sh
    a
    bash-3.2$ unset
    bash-3.2$ cat test.sh
    echo $A
    echo $B
    bash-3.2$ A=a B=$A ./test.sh
    a
    bash-3.2$ unset
    bash-3.2$ A=a B=$A ./test.sh
    a
    a
    bash-3.2$ A=a B=$A ./test.sh
    a
    bash-3.2$ unset
    bash-3.2$ ./test.sh
    bash-3.2$ A=a B=$A ./test.sh
    a
    bash-3.2$

    bash-3.2$ ls -l test.sh
    -rwxr-xr-x  1 axure  staff  16 Mar 29 09:27 test.sh
    bash-3.2$ cat test.sh
    echo $A
    echo $B
    bash-3.2$ pwd
    /Users/axure
    bash-3.2$ A=a B=$A ./test.sh
    a
    a
    As I would expect
    bash-3.2$ A=a B=$A ./test.sh
    a
    NOT what I would expect.  I tested this using bash 3.2 and got the same results, HOWEVER, when I tested this with bash 4.0, I got what I expected, namely your first results everytime.
    So I think there is a bug in bash 3.2.  You can get the bash sources, and build your own bash if you wish, or use a different method of setting 1 time envionment variables for use in a subprocess.
    bash-3.2$ $A
    bash-3.2$ $B
    bash-3.2$ echo $A
    bash-3.2$ echo $B
    As expected, as the way you set A & B were as 1 time environment variables that were only seen by the subprocess created when test.sh was run.  A & B were NOT created in the current shell environment, so the current shell environment would not have any values for A & B
    bash-3.2$ unset
    bash-3.2$ A=a B=$A ./test.sh
    a
    a
    bash-3.2$ A=a B=$A ./test.sh
    a
    Again, now what I would expect, but as I have already stated, I think there is a bug in bash 3.2 that does not exist in bash 4.0.
    Now a bigger question, why are you passing A & B as 1 time envionment variables?  Why not just pass them on the command line?
    test.sh a a
    where test.sh would be
    echo $1
    echo $2
    Or you could use export to create environment variables A & B
    export A=a
    export B=$A
    test.sh
    Now A & B would still exist after test.sh, which I assume you do not want to do.
    You could try ceating test.sh as a bash function and see if that changes the behavior
    test()
        echo $A
        echo $B
    A=a B=$A test
    You would have to define test() in your shell initialization scirpt if you needed each time you started a terminal session.
    While I have used 1 time environment variables, I more frequently just pass arguments on the command line.

  • Passing parameters from shell script to OWB process flow

    Hi all,
    I am running OWB process flow (using the template script provided by oracle) and i want to pass two date parameters as shown below:
    sqlplus -s $SQL_USER/$SQL_PWD@$ORACLE_SID @$HOME_DIR/src/vmc_oem_exec_script.sql OWB_OWNER VMC_POST_DW_PF_LOC_SIT PROCESS VMC_NM1_PORT_MAIN "," "P_DATE_FROM=$DATE_FROM,P_DATE_TO=$DATE_TO"
    How do i catch those values in process flow and pass those to mappings in Process flow?
    Do i need to create PF variables with same names or any name will do?
    Thanks in advance

    This document is explaining how to pass data between activities in process flow.
    I am passing parameters from a shell script.
    Any ideas,how to pass parameters from shell script and then initialize the process flow variables based on those values and then pass them further to mappings.
    Thanks

  • How to pass variable to SQLPLUS in a ksh script?

    Hi,
    I am writing a ksh script which will use sqlplus to run a sql and pass 2 variables as the SQL request. In the ksh script, I have 2 variables which are $min_snap and $max_snap holding 2 different numbers.
    Inside the same script, I am using SQLPLUS to run an Oracle SQL script, which request to enter 2 set of numbers, one at a time. Normally running situation, I can enter the number from the keyboard, but since I am writing a script, I want to pass those numbers by passing variables in the script? How can I do it?
    Please help!
    here is my ksh script,
    #!/bin/ksh
    if [ "$1" = "" ]
    then
    echo "Usage : delete_snapshot.sh <db_name>"
    exit
    fi
    export ORACLE_BASE=/oracle1/app/oracle
    export ORACLE_PATH=.:/oracle1/app/oracle/product/8.1.7/tune
    export ORACLE_HOME=/oracle1/app/oracle/product/8.1.7
    export ORACLE_RDBMS=$ORACLE_HOME/rdbms/admin
    export ORACLE_SID=$1
    curr_time=`date +"%m/%d/%y %H:%M:%S"`
    log_file=/home/mdbtuner/stats/sppurge/log/{$ORACLE_SID}_`date +"%Y%m%d"`.log
    #echo $log_file
    echo "****** Delete Snapshot for $ORACLE_SID at $curr_time ******" >> $log_file
    #echo "****** Delete Snapshot for $ORACLE_SID at $curr_time ******"
    #echo $ORACLE_HOME/bin/sqlplus -S perfstat/perf$ORACLE_SID@$ORACLE_SID
    cd /home/mdbtuner/stats/sppurge
    $ORACLE_HOME/bin/sqlplus -S perfstat/perf$ORACLE_SID@$ORACLE_SID << EOF > $min_snap
    @min_snapid.sql
    exit;
    EOF
    $ORACLE_HOME/bin/sqlplus -S perfstat/perf$ORACLE_SID@$ORACLE_SID << EOF > $max_snap
    @max_snapid.sql
    exit;
    EOF
    echo $min_snap $max_snap
    cd $ORACLE_RDBMS
    #$ORACLE_HOME/bin/sqlplus -S perfstat/perf$ORACLE_SID@$ORACLE_SID << EOF >> $log_file
    $ORACLE_HOME/bin/sqlplus -S perfstat/perf$ORACLE_SID@$ORACLE_SID << !
    @sppurge
    $min_snap
    $max_snap
    exit;
    #EOF
    Thanks in advance!
    Robert
    Message was edited by:
    user168

    Thank you for response, Paul.
    Have you ever used statspack? or sppurge.sql?
    When you run $ORACLE_HOME/rdbms/admin/sppurge.sql, it waits for user to enter losnapid and hisnapid manually from the keyboard.
    My trouble is to have a script to delete old snapshot which are 3 weeks old. So I create min_snapid.sql and max_snapid.sql to hold two variables.
    Based on your solution, I tried it but it doesn't work.
    It returns the error messages as following....
    Warning
    ~~~~~~~
    sppurge.sql deletes all snapshots ranging between the lower and
    upper bound Snapshot Id's specified, for the database instance
    you are connected to.
    You may wish to export this data before continuing.
    Specify the Lo Snap Id and Hi Snap Id range to purge
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Enter value for losnapid: Using exit; for lower bound.
    Enter value for hisnapid:
    User requested Interrupt or EOF detected.
    Enter value for hisnapid:
    User requested Interrupt or EOF detected.
    WARNING: LoSnapId or HiSnapId specified does not exist in STATS$SNAPSHOT
    Enter value for hisnapid:
    User requested Interrupt or EOF detected.
    Purge of specified Snapshot range complete. If you wish to ROLLBACK
    the purge, it is still possible to do so. Exitting from SQL*Plus will
    automatically commit the purge.
    -------------------------------------------

  • Can any one tell me how can i call a shell script from pl/sql

    i like to call shell script from pl/sql procedure.
    can any one suggest how can i do this

    Have you not mastered in asking the same kind of question ?
    First do write a script...
    no one will spoon feed you.
    How can i call a shell script from procedure
    How to call Shell Script from pl/sql block
    -Sk

  • How can i call a shell script from procedure

    I have a shell script.now i am i a situation to call that shell script from one of my procedures and need to get a value from that script.
    can u suggest me that how can a call the shell script from pl/sql?

    Is the same question you asked here
    How to call Shell Script from pl/sql block
    -SK

  • OBIEE 11g How to pass variable from one prompt to another prompt in dashboard page.

      How to pass variable from one prompt to another prompt in dashboard page.
    I have two prompt in dashboard page as below.
    Reporttype
    prompt: values(Accounting, Operational) Note: values stored as
    presentation variable and they are not coming from table.
    Date prompt values (Account_date, Operation_date)
    Note:values are coming from dim_date table.  
    Now the task is When user select First
    Prompt value  “Accounting” Then in the
    second prompt should display only Accounting_dates , if user select “operational”
    and it should display only operation_dates in second prompt.
    In order to solve this issue I made the
    first prompt “Reporttype” values(Accounting, Operational) as presentation
    values (custom specific values) and default presentation value is accounting.
    In second prompt Date are coming from
    dim_date table and I selected Sql results as shown below.
    SELECT case when '@{Reporttype}'='Accounting'
    then "Dates (Receipts)"."Acct Year"
    else "Dates (Receipts)"."Ops
    Year"  End  FROM "Receipts"
    Issue: Presentation variable value is not
    changing in sql when user select “operation” and second prompt always shows
    acct year in second prompt.
    For testing pupose I kept this presentation
    variable in text object of dashboard and values are changing there, but not in
    second prompt sql.
    Please suggest the solution.

    You will want to use the MoveClipLoader class (using its loadClip() and addListener() methods) rather than loadMovie so that you can wait for the file to load before you try to access anything in it.  You can create an empty movieclip to load the swf into, and in that way the loaded file can be targeted using the empty movieclip instance name.

  • How to pass Variable value to SWF file in Eclipse development

    We are creating Widget file in Eclipse by using SAP Widget Foundation .
    We included one SWF file in Widget & it is working fine.
    But we are not able to pass the values to SWF file variables.?
    How to pass variables to SWF file let us know.
    Thanks & regards

    We are creating Widget file in Eclipse by using SAP Widget Foundation .
    We included one SWF file in Widget & it is working fine.
    But we are not able to pass the values to SWF file variables.?
    How to pass variables to SWF file let us know.
    Thanks & regards

  • LMS 3.1 Syslog Automated Action - How to pass variables to script?

    I would like to pass variables to a windows bat file for processing.  The help seems to suggest that there are 2 available, device and message.  I would like to know how to reference them and what syntax to use to pass them to the batch file.  Are Facility, Sub-facility, Severity, Mnemonic and Description also availble? If so, how would they be referenced?  Thanks in advance.

    The syntax for referencing these variables is discussed in the online help.  Essentially, you'll want to use %~1 and %~2 in your batch script to get the device and message respectively.  The message will be the full message, so you will need to do additional processing on that to extract the facility, severity, and mnemonic.

  • Passing AppleScript string variable to shell script

    I have a script which uses the md5 command line utility to make convenient-sized hashes of some very long strings. Right now I save each string in a temporary text file which is then referenced in the command line:
    set hash to do shell script "md5 -q" & space & quote & POSIX path of tempFile & quote
    This works well, but I wonder if it isn't a little inefficeint, re-writing the temporary file with each new string. md5 has a -s option, which allows the string data to be placed directly in the command line:
    set myText to "Hello World"
    set hash to do shell script "md5 -q -s" & space & quote & myText & quote
    I know that if I do it this way I have to be careful to "escape" all occurrences of quote characters within myText to avoid command line syntax problems. This would not be difficult (in fact, it has already been done for another reason), but I have two questions:
    (1) Are there any other ASCII characters that would have to be similarly escaped? I've tried strings with line breaks in them: Mac-, Unix-, and Windows-style breaks, and they all seem to work, but are there any hidden dangers to doing this?
    (2) myText can get very long: say, 10,000 characters or more, so the command line would be correspondingly long. Is there any kind of limit on the length of command lines in the particular species of UNIX that is running under the Mac hood?
    Many thanks.
    Dual 1.2 GHz   Mac OS X (10.4.8)  
    Dual 1.2 GHz    

    >(1) Are there any other ASCII characters that would have to be similarly escaped? I've tried strings with line breaks in them: Mac-, Unix-, and Windows-style breaks, and they all seem to work, but are there any hidden dangers to doing this?
    There are many characters that can fall foul of a do shell script command, which is why Apple gave a convenient way of handling it via quoted form of:
    <pre class=command>set myText to "Hello World"
    set hash to do shell script "md5 -q -s "  & quoted form of myText</pre>
    This will take care of escaping various characters that might confound the shell.
    >(2) myText can get very long: say, 10,000 characters or more, so the command line would be correspondingly long. Is there any kind of limit on the length of command lines in the particular species of UNIX that is running under the Mac hood?
    It varies by OS version, but 262,000 bytes is the technical limit.

  • Passing password from shell script to Java

    Hi there,
    I have a shell script which has user id and password stored in variables. I call a java program from this shell script. I tried accessing this environment variable from java using system.getproperty and java is not getting the values. I have used export USERID PASSWORD
    and java classname to call it.
    I do not want to pass it as arguments because of security reasons. can anybody help me please.
    Thanks a bunch.

    Hi there,
    I have a shell script which has user id and
    password stored in variables. I call a javaprogram
    from this shell script. I tried accessing this
    environment variable from java using
    system.getproperty and java is not getting the
    values. I have used export USERID PASSWORD
    nd java classname to call it.
    Presumably you are using one of the newer java
    versions.
    Questions
    1. What statements are you using to set, export and
    run java?
    2. What shell are you using?
    3. How are you accessing the vars in java?
    I do not want to pass it as arguments because of
    security reasons. can anybody help me please.
    That is nonsensical. Putting it in env vars exposes
    it more than passing it as args.Thanks for replying jschell.
    1. I am using newer version java 1.5
    2. shell scripts gets it's variables from oracle reports through webservices.
    3. to run java i use java javaclassname3. I used EXPORT variablename and in java called system.getproperty(variablename)But system.getproperty is getting a null.
    And the decision about not passing it as args was made by our client. They think it's not safe to pass password.
    are they wrong??
    Please help me.

  • How to pass variables to Skin applied with skinClass?

    Hi all,
    I'm experimenting with new skin for a SkinnableContainer, and I would like to pass variables to that skin to dynamically change some elements.
    This is how I would like it to work, but it doesn't. Is there a way to make it work? (Or something similar... like defining new stylesheet-elements in the skin.)
    <s:SkinnableContainer skinClass="skins.SkinnableContainerBackground" gradient1="0xFFF000" gradient2="0x000FFF>
    <s:RichText id="rt1" width="400" height="200"  />
    </s:SkinnableContainer>
    Skin:
    <s:Skin xmlns:s="library://ns.adobe.com/flex/spark"
            xmlns:fx="http://ns.adobe.com/mxml/2009"
            xmlns:d="http://ns.adobe.com/fxg/2008/dt"
            xmlns:ai="http://ns.adobe.com/ai/2008"
            height="100%"
            width="590">
        <s:layout>
            <s:BasicLayout/>
        </s:layout>
        <s:states>
            <s:State name="normal"/>
            <s:State name="disabled"/>
        </s:states>
        <fx:Metadata>[HostComponent("spark.components.SkinnableContainer")]</fx:Metadata>
        <fx:Script>
            <![CDATA[
                [Bindable] public var gradient1:uint;
                [Bindable] public var gradient2:uint;
            ]]>
        </fx:Script>
        <s:Group top="0"
                 bottom="0"
                 left="-11"
                 right="0">
            <s:Group x="15"
                     top="0"
                     bottom="0"
                     id="kaft">
                <!--            <s:filters>
                     <s:DropShadowFilter alpha="0.4"
                     blurX="6"
                     blurY="6"
                     distance="4.24264"
                     quality="3" />
                     </s:filters>
                -->
                <s:Rect width="586"
                        ai:knockout="0"
                        d:userLabel="kaft"
                        top="0"
                        bottom="0">
                    <s:fill>
                        <s:LinearGradient y="82.3125"
                                          scaleX="585.975"
                                          rotation="-0">
                            <s:GradientEntry color="{gradient1}"
                                             ratio="0.466667"/>
                            <s:GradientEntry color="{gradient2}"
                                             ratio="1"/>
                        </s:LinearGradient>
                    </s:fill>
                </s:Rect>
            </s:Group>
        </s:Group>
        <s:Group id="contentGroup"
                 left="20"
                 right="20"
                 top="10"
                 bottom="20">
            <s:layout>
                <s:BasicLayout/>
            </s:layout>
        </s:Group>
    </s:Skin>

    ou can also define custom CSS styles:
    MySkinnableContainer.as
        [Style(name="gradientA", type="uint", format="Color", inherit="no")]
        [Style(name="gradientB", type="uint", format="Color", inherit="no")]
        public class MySkinnableContainer extends SkinnableContainer
            public function MySkinnableContainer()
                super();
    MySkinnableContainerSkin.mxml
    <s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/halo"
                 xmlns:s="library://ns.adobe.com/flex/spark">
        <fx:Metadata>
            <![CDATA[
            [HostComponent("MySkinnableContainer")]
            ]]>
        </fx:Metadata>
        <s:states>
            <s:State name="normal" />
            <s:State name="disabled" />
        </s:states>
        <s:Group bottom="0" left="-11" right="0" top="0">
            <s:Group id="kaft" x="15" bottom="0" top="0">
                <s:Rect width="586" bottom="0" top="0">
                    <s:fill>
                        <s:LinearGradient y="82.3125" scaleX="585.975" rotation="-0">
                            <s:GradientEntry color="{getStyle('gradientA')}" ratio="0.466667" />
                            <s:GradientEntry color="{getStyle('gradientB')}" ratio="1" />
                        </s:LinearGradient>
                    </s:fill>
                </s:Rect>
            </s:Group>
        </s:Group>
        <s:Group id="contentGroup" bottom="20" left="20" right="20" top="10" />
    </s:SparkSkin>
    styles.css
    @namespace local "*";
    local|MySkinnableContainer {
        gradientA: #FF0000;
        gradientB: #000FFF;
        skinClass: ClassReference("MySkinnableContainerSkin");   
    main app:
        <fx:Style source="styles.css" />
        <local:MySkinnableContainer width="590" height="100%">
            <s:RichText id="rt1" width="400" height="200" color="#000000" text="test" />
        </local:MySkinnableContainer>

  • Getting error when passing variable to Matlab script

    Hi
    I am using LabVIEW 2013 Version 13.0f2 (32bit) and MATLAB R2014b (Version: 8.4.0.150421) in Windows 7 Professional  Version 6.1 (Build 7601: Service Pack 1).
    I am trying to pass measured data to a matlab script to plot but I get errors.
    I have made a small program to make the problem easyer to solve and I get this error
    Error 1050 occurred at LabVIEW:  Error occurred while executing script. Error message from server: ??? Reference to a cleared variable A.
    . in MatlabTest.vi
    I tried the solution mentioned in http://digital.ni.com/public.nsf/allkb/4475BC3CEB062C9586256D750058F14B though it was intended for an older version. This gave me this error instead
    Error 1048 occurred at LabVIEW:  LabVIEW failed to get variable from the script server. Server:"??? Undefined function or variable 'num'.
    " in MatlabTest.vi
    The problem occures when I try to access the input, in other words I can have inputs to my script as long as I do not use them.
    How can I solve this?
    Attachments:
    MatlabTest.vi ‏7 KB

    Thank you so very much.
    I shold of cours have realised that that was what happened but I always use the three clearing lines (close all, clear all, clc) in the beginning of a script to make sure that no old and irrelevant data corrupts my script and did not think about when the inputs were generated.
    Again, Thank you!

  • Problem while passing parameter to shell script which sends email-Ora Apps

    Hi,
    I have a pl/sql package which will call a shell script program.The shell script program is written in order to send the invoice hold details of AP as a mail.The parameters to this program are passed in the pl/sql package.
    The shell script program has
    5 parameters namely
    to - email
    from - email
    hold id - which is a number
    hold name - varchar2( free text)
    hold reason - varchar2( free text)
    the shell script looks as below.
    FROM_EMAIL=`echo $1|cut -f9 -d " "|sed 's/\"//g'`
    echo "From email id is $FROM_EMAIL" -- From email
    TO_EMAIL=`echo $1|cut -f10 -d " "|sed 's/\"//g'`
    echo "To Email id is $TO_EMAIL" -- to email
    PARAM0=`echo $1 | awk '{print $11}'|sed -e "s/\"//g"`
    echo "Param0: $PARAM0" -- hold id
    PARAM1=`echo "$1" | cut -d" " -f12-| sed -e "s/\" \"/\"^\"/g" | awk -F'^' '{print $1}'|sed -e "s/\"//g"`
    echo "Param1: $PARAM1" -- hold name
    PARAM2=`echo "$1" | cut -d" " -f13-| sed -e "s/\" \"/\"^\"/g" | awk -F'^' '{print $1}'|sed -e "s/\"//g"`
    echo "Param2: $PARAM2" -- hold reason
    the values that am passinf to this program are if suppose
    from email ---- [email protected]
    to email [email protected]
    12345 ------ hold id
    test hold name ------ hold name
    test hold reason ------- hold reason
    The output for the above parameters is as follows
    from email ---- [email protected]
    to email [email protected]
    12345 ------ hold id
    test hold name ------ hold name
    hold name --------hold reason (a part of hold name parameter is displayed as hold reason.The reason being in param2 we used cut which is cutting from 13.
    the problem here is since param1 being free text we cannot predict at what position the parameter ends.i mean there might be a single word or more than 2 words in that parameter seperated by space. the question here is ... is there anyway that we can specify dynamically from which location the param2 should fetch the value.
    can we use some delimiter to identify the end of param1 and start of param2.If so... how can it be written in this scenario.
    Thanks in Advance.

    As I see, all parameters are merged into 1 at shell script.
    Please do as follow:
    1- Modify your shell script as followed:
    echo "From email id is $1" -- From email
    echo "To Email id is $2" -- to email
    echo "Param0: $3" -- hold id
    echo "Param1: $4" -- hold name
    echo "Param2: $5" -- hold reason
    2- rename your shell script file with .prog extension : CUSTOM_NAME.prog
    3- perform the following command at custom file location:
    ln -s $FND_TOP/bin/fndcpesr CUSTOM_NAME
    This approach will seperate your parameters and then it will be more easier to manipulate them.
    Regards

Maybe you are looking for