Duplicate Text From Shell Script in Automator

I'm trying to run a automator script that allows me to select a couple of files, run a sha1 checksum, and output a text file. My current version works 100% within the automator app, however when I use it as a context menu service, it outputs duplicate text. Here's my current workflow and what it outputs.
Get Selected Folder Items
Run Shell Script
Copy to Clipboard (I've tried "new text file", and "new textedit file" as well)
Outputs:
SHA1(~/Desktop/Actions/Test/TEST.atn)= 88902acfb51e0f9a0c6dbedce69ce9618e26bc00
SHA1(~/Desktop/Actions/Test/TEST.atn)= 88902acfb51e0f9a0c6dbedce69ce9618e26bc00
Any help would be appreciated.

Snow Leopard's Services workflow is automatically passed the type of selected items (that is what the selections at the top of workflow window are for), so just remove the *Get Selected Finder Items* action, since that is having the result of doubling the input items.

Similar Messages

  • Problem while calling concsub from shell script

    Hi All,
    I am facing problem when I am trying to run CONCSUB utility from shell script.The same works well when I try it from command line.The only prob I am facing from shell script is assigning values to temporary variables.
    This is how my script looks
    #!/bin/bash
    export PARM5="$5"
    export PARM6="$6"
    export PARM7="$7"
    echo "INTPARM5=\"$PARM5\""
    echo "INTPARM6=\"$PARM6\""
    echo "INTPARM7=\"$PARM7\""
    echo $FND_TOP/bin/CONCSUB $1 ONT 'Order Management Super User, Vision Operations (USA)' $3 WAIT=Y CONCURRENT ONT $PROGRAM "$INTPARM5" "$INTPARM6" "$INTPARM7"When I try to run the above shell based concurrent program it doesn't pass the parameters as expected and it errors out saying "Wrong number of arguments to call the procedure"
    I tried my luck from some of the previous posts ({thread:id=2360776} ),but to vain
    If anyone has any ideas,please suggest!!
    Thanks in advance!!
    Edited by: sandy on May 4, 2013 12:54 PM

    Here are your proofs
    Proocedure
       PROCEDURE abc(--p_errbuf            OUT   VARCHAR2,
                                                --p_errcode           OUT   VARCHAR2,
                                 p_order_no          IN    NUMBER DEFAULT NULL,
                                                p_customer_id       IN    NUMBER DEFAULT NULL,
                                 p_name              IN    VARCHAR2 DEFAULT NULL
          IS
                    v_cname    VARCHAR2(200);
               v_ordered_date DATE;
               v_order_number  NUMBER;
              v_order_type    VARCHAR2(200);
    BEGIN
                fnd_file.put_line(fnd_file.output, 'Begin Execution');
       SELECT DISTINCT ac.customer_name,
                    d.ordered_date ordered_date,
                    d.order_number order_number,
                    x.NAME order_type
            INTO   v_cname
               ,v_ordered_date
               ,v_order_number
               ,v_order_type
               FROM oe_order_headers_all d,
                    oe_transaction_types_tl x,
                    wsh_delivery_details b,
                    wsh_delivery_assignments c
                    ,ar_customers ac
              WHERE 1 = 1
                AND ac.customer_id = b.customer_id
                AND d.order_type_id = x.transaction_type_id
                AND x.LANGUAGE = 'US'
                AND b.released_status = 'B'
                AND b.source_header_id = d.header_id
                AND c.delivery_detail_id = b.delivery_detail_id
                AND d.order_number=NVL(p_order_no,d.order_number)
                AND ac.customer_id = NVL(p_customer_id,ac.customer_id)
             AND x.name=NVL(p_name,x.name)
                AND NOT EXISTS (SELECT 1
                                FROM wsh_delivery_details b
                               WHERE 1 = 1
                                      AND b.released_status != 'B'
                                      AND b.source_header_id = d.header_id)
                                       --BETWEEN ('1213794') and ('1213797'))
                AND rownum<2;
            INSERT INTO xxc_temp(customer_name,ordered_date,order_number,order_type) VALUES(v_cname,v_ordered_date,v_order_number,v_order_type);
            COMMIT;
             fnd_file.put_line(fnd_file.output, 'Order Number is' || v_order_number);
             fnd_file.put_line(fnd_file.output, 'Order Type is'   || v_order_type);
       END;Script
    #!/bin/bash
    set -x
    export PARM5="$5" 
    export PARM6="$6"
    export PARM7="$7"
    sqlplus -s $1 <<EOF
    set head off feed off serverout on size 1000000
    exec abc('$PARM5','$PARM6','$PARM7');
    exit
    EOFNow when I run the 'XX Order Detail CSV Report' I get the below log and no Output
    +---------------------------------------------------------------------------+
    Application Object Library: Version : 12.0.0
    Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
    XXKES_PDF_TRANSFER module: XX Order Detail CSV Report
    +---------------------------------------------------------------------------+
    Current system time is 06-MAY-2013 05:05:56
    +---------------------------------------------------------------------------+
    + export PARM5=66432
    + PARM5=66432
    + export PARM6=
    + PARM6=
    + export PARM7=Mixed
    + PARM7=Mixed
    + sqlplus -s APPS/APPS
    +---------------------------------------------------------------------------+
    Executing request completion options...
    Output file size:
    0
    +------------- 1) PRINT   -------------+
    Disabling requested Output Post Processing.  Nothing to process.  The output of the request is zero byte.
    +--------------------------------------+
    Finished executing request completion options.
    +---------------------------------------------------------------------------+
    Concurrent request completed successfully
    Current system time is 06-MAY-2013 05:05:56
    +---------------------------------------------------------------------------+After the concurrent program executed I queried the table xxc_temp and here you see the data
    SQL> select * from xxc_temp;
    CUSTOMER_NAME
    ORDERED_D ORDER_NUMBER ORDER_TYPE
    A. C. Networks
    18-FEB-13        66432 MixedMy procedure fetches the data fro given set of i/p parameters but it doesn't give o/p coz it's a host based conc program.Please advise if there's a way to get the o/p in a host based conc program
    Thanks!!

  • Please help to call oracle procedure with out paramter from shell script

    Hi
    I want to call a process with out parameter from shell script. I am calling process in shell script in below way
    function Process_loads {
    ( echo 'set serveroutput on size 1000000 arraysize 1'
    echo "set pagesize 0 term on verify off feedback off echo off"
    echo "BEGIN"
    echo " dbms_output.put_line('Before Calling The package'); "
    echo " x ( '$1', '$2', '$2', '$4', '$5', '$error_code'); "
    echo " dbms_output.put_line('After Calling The package'); "
    echo "EXCEPTION "
    echo " WHEN OTHERS THEN "
    echo " dbms_output.put_line('BIN_LOAD_ERROR' || SQLERRM); "
    echo " ROLLBACK;"
    echo "END;"
    echo "/" ) | sqlplus -s $USER/$PASSWORD@$SID
    Here $error_code is out paramter. All varaibles passed in process are declared with export command.
    When executing .sh it gives below error
    "sh ERROR at line 3: ORA-06550: line 3, column 99: PLS-00363: expression '' cannot be used as an assignment target ORA-06550: line 3, column 3: PL/SQL: Statement ignored".
    Please help to get rid from this error or please suggest how to call a oracle procedure with out paramter from unix shell script.
    Thanks in advance

    You can try this:
    From sql*plus
    SQL> ed
      1  create or replace procedure my_proc(p_id in int, p_result out int)
      2  as
      3  begin
      4  select 10 * p_id
      5  into p_result
      6  from dual;
      7* end my_proc;
    SQL> /
    Procedure created.
    SQL> set serveroutput on
    SQL> declare
      2  v_r int;
      3  begin
      4  my_proc(10,v_r);
      5  dbms_output.put_line(v_r);
      6  end;
      7  /
    100
    PL/SQL procedure successfully completed.
    from bash:
    testproc.sh:
    #!/bin/bash
    (echo 'set serveroutput on';
    echo 'declare';
    echo 'v_r int;';
    echo 'begin';
    echo 'my_proc(10,v_r);';
    echo 'dbms_output.put_line(v_r);'
    echo 'end;';
    echo '/';) | sqlplus -s u1/u1
    Console:
    oracle@mob-ubuntu:~$ chmod u+x testproc.sh
    oracle@mob-ubuntu:~$ ./testproc.sh
    100
    PL/SQL procedure successfully completed.With kind regards
    Krystian Zieja

  • 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

  • Query v$ views from shell script fail

    Hi everybody,
    the query below is runing well with a SQL*PLUS (database is mounted and not open)
    SQL> SELECT member FROM v$logfile;
    MEMBER
    +DATA/testgfi/onlinelog/group_1.298.773871647
    +DATA/testgfi/onlinelog/group_2.294.773871647
    +DATA/testgfi/onlinelog/group_3.295.773871647
    But Giving error if I run it from Shell script ???
    $ sqlplus -s '/ as sysdba' << EOF
    SELECT member FROM v$logfile;
    EOFSELECT member FROM v
    ERROR at line 1:
    ORA-01219: database not open: queries allowed on fixed tables/views only..
    Please help..
    Thanks..
    Aljaro

    Aljaro wrote:
    Hi everybody,
    the query below is runing well with a SQL*PLUS (database is mounted and not open)
    SQL> SELECT member FROM v$logfile;
    MEMBER
    +DATA/testgfi/onlinelog/group_1.298.773871647
    +DATA/testgfi/onlinelog/group_2.294.773871647
    +DATA/testgfi/onlinelog/group_3.295.773871647
    But Giving error if I run it from Shell script ???
    $ sqlplus -s '/ as sysdba' << EOF
    SELECT member FROM v$logfile;
    modify as below
    SELECT member FROM v\$logfile;

  • Accept input from Shell script in sql*plus

    Hey! Guys..
    i need the following info.
    I am running a shell script from sql*plus. I need to accept a value from shell script into my .sql file.
    thanks..
    Harsh.

    prompt for input, pass to another shell
    # contract_status_prompt.sh
    read udate?"Enter week-ending date in format dd-mmm-yyyy: "
    contract_status_update.sh $udate >$FDWLOG/current/contractstatusupdate`date +%d%h%y`.log
    echo `date`
    # End contract_status_prompt.sh
    Read the variable passed and use in SQLPlus:
    # contract_status_update.sh
    echo "Running contract_status.sh"
    echo "create records for contract_status"
    echo `date`
    echo " "
    echo " date used is "; print $1
    echo " "
    sqlplus <<exit
    @$FDWSQL/sqlparms
    set time on
    prompt *** Set contract_status_period ***
    update contract_status_period
    set period_date = '$1';
    commit;
    exit
    etc.

  • Urgent Problem in Executing perl script from shell script

    Hello,
    I've a shell script on one server (source) and a perl script on another (target).
    My perl script will check whether the directoryname, filename provided by shell script exists on the target server or not.
    My shell script is as follows:
    #! bin/bash
    cmd=`ssh user@target "perl /home/user/test_dir/validate_file.pl"`
    echo $cmd
    And my perl script uses a package CU_Functions.pm, which is in the same directory as the perl script on the target server.
    But when I invoke the perl script from shell script, I get the following error:
    Source:user> (db:ias10g12_mid_db) /home/user/perl
    $ sh /home/user/arcs/arcs_conn.sh
    user@target's password:
    Can't locate CU_Functions.pm in @INC (@INC contains: /local/perl-5.6.1/lib/5.6.1/i686-linux /local/perl-5.6.1/lib/5.6.1 /local/perl-5.6.1/lib/site_perl/5.6.1/i686-linux /local/perl-5.6.1/lib/site_perl/5.6.1 /local/perl-5.6.1/lib/site_perl .) at /home/user/test_dir/validate_file.pl line 13.
    BEGIN failed--compilation aborted at /home/user/test_dir/validate_file.pl line 13.
    Please let me know if I need to do any configurations prior to call the perl script.

    As for the Perl INC, I cannot recall the environment variable that sets that but the following example should work:
    ssh user@host "export ENV_VAR=/path/to/include/files:$ENV_VAR ; /full/path/to/script"

  • Exports (from shell script) without password given explicitly in script

    Hi All,
    I have Oracle 10g2 on SLES 10 64-bit. I would like to do export the database using data pump from shell scripts. Is there any method to hide the password in the script file.
    Currently in doing by command:
    expdp system/password@database ....
    So any user who see the script will know the passowrd.
    Regards
    Groxy

    Hi,
    Have you considered the "Secure External Password Store" feature that was added in 10gR2? It uses the Oracle Wallet to store a database_alias with username/password credentials in encrypted format. Then you can enter your expdp command like this:
    expdp /@database_alias ...
    Take a look at the 10gR2 Security Guide. There's a chapter there on how to set this up.
    John

  • Calling a java code from shell script.

    Hi all,
    I want to access a method of java class from a unix shell script.basiacally I want to know how to access a java code from a shell scriptt.If anybody has any info on this , kindly revert back to me.
    Rgds,
    Satya

    Hi,
    Suppose I hv a main() method.
    Then how to access that class from Shell Script.
    Can u send me the piece os compiling and running process for it.
    Rgds,
    Satya

  • Can't enter shell scripts in Automator?

    When adding the "Run Shell Script" action to a workflow in Automator, I can't actually type anything in the text box -- when I try to type something, I just get a bunch of seemingly random characters. Does anyone else see the same behaviour or is there just something funky going on with my two Macs?
    I'm certain I'd be able to create a couple of services for encrypting/decrypting messages in Mail with GPG, if only I could actually type the shell script into Automator

    Redemption Code http://helpx.adobe.com/x-productkb/global/redemption-code-help.html

  • Capturing output of shell script in Automator

    I have an Automator work flow that includes the execution of a shell script.  The script in turn executes a Perl script and captures its output on a file.  This may sound a bit convoluted, but the Automator part was intended to automate disparate scripts that were already made, so I just "glued" them together.
    The shell script is like this:
    cd "/Users/username/Documents/Development/"
    ./script.pl "$1" 2>&1 >out.log
    The problem is that, after execution, "out.log" contains the output from STDOUT, but not STDERR.  I know because if I run "script.pl" from the Terminal, I get not only the normal output, but a couple of errors or warnings spit out by the script.
    I was under the impression that "2>&1>out.log" would redirect STDERR to the filehandle used by STDOUT, and then redirect STDOUT to the file, with the ultimate result of redirecting both filehandles to the output file.
    Is there something I'm missing?  How can I capture the STDERR from the script as well?  Keep in mind that the shell script is executed from an Automator work flow.
         Thanks!
         -dZ.

    ./script.pl "$1" >out.log 2>&amp;1
    It is important to redirect in the correct left-to-right order.
    First move STDOUT (file descriptor 1) to the file, THEN move STDERR (file descriptor 2) to where STDOUT is NOW pointing.
    You moved STDERR first, then moved STDOUT, leaving STDERR behind.

  • Problems using Shell scripts and Automator

    My problem is that when I use the "Run Shell Script" Automator action, it won't work if I type the script inside the action but it will work if I just type a path to the script file, which is less elegant as I then need to copy the Automator app made as well as the script file.
    Here is the script I am trying to use
    #!/bin/bash -f
    if test -f ~/Library/Preferences/SPACE.com/Pro/Registration\ File
    then
    open -a /Applications/Starry\ Night\ High\ School/Starry\ Night\ High\ School.app/
    else
    ditto /Library/Management/Preferences/StarryNight/SPACE.com ~/Library/Preferences/SPACE.com
    open -a /Applications/Starry\ Night\ High\ School/Starry\ Night\ High\ School.app/
    fi
    exit 0

    Well I found the problem. Or at least I got it to work. I tried typing simple commands and scripts into the Shell Script action and had no issues with it running. So I then slowly expanded and typed out my script:
    #!/bin/bash -f
    if test -f ~/Library/Preferences/SPACE.com/Pro/Registration\ File
    then
    open -a /Applications/Starry\ Night\ High\ School/Starry\ Night\ High\ School.app/
    else
    ditto /Library/Management/Preferences/StarryNight/SPACE.com ~/Library/Preferences/SPACE.com
    open -a /Applications/Starry\ Night\ High\ School/Starry\ Night\ High\ School.app/
    fi
    exit 0
    Having typed it out in the script it runs fine. It seems you can't paste text into the action. To test this hypothesis, I copied the working script out of automator into BBedit and then back into Automator, the script no longer worked. Not sure why that is happening, but it does work if I type the scripts out.

  • Two questions regarding shell scripts in automator

    they are both concerning this script:
    I pass it an .avi file (I believe it could also take more than one), and outputs a converted file (that is playable on appletv2) that is dumped in my "Converted" folder.  This all works fine and dandy.
    However, I would like to have it prompt the user for a destination folder, and pass that in as well.  However, I do not know how I would refer to that variable separately.
    Handbrake's CLI application also produces output that shows what percentage the conversion is at, and although the script passes this output as it's own output (to the next automator action - I actually discovered this only by accidentally leaving a "Speak Text" action in), I want to be able to see this output in real time.  Is there anyway to do this?  Thanks for the help!

    To be clear, this is what you mean, correct?
    for outpath; do :; done
    for f in "$@"
    do
        if [ "$f" != "$outpath" ];
              thenof="$outpath"/`basename "$if" .avi`.mp4
        /Applications/HandBrakeCLI -i "$if" -o "$outpath" --preset="AppleTV 2"
        fi
    done
    I assume that "Ask For Finder Items" also passes it's input along to the next action?  Would "Get Value of Variable" do the same thing?  (I also use the same workflow to convert .mkv files and copy .srt files to the same destination folder, so I need to access the source files multiple times to filter out different files each time).
    I would just test it myself, but I am not at my computer right now.
    And this is kind of off topic, but since automator actions can be written in shell script, could this be easily made into one? How much work would it involve? 

  • Return Files from shell script

    I have an automator workflow I'm working on that will take FLACs and convert them to AIFF. I do the brunt of the work in a bash script. I have that working just fine, but I'm wanting to output an array (or however I need to do it) of files to then pass to "Import Audio Files". How could I output something that "Import Audio Files" will like from my shell script? Thanks.

    ... nevermind. *slaps himself in the head* Just echoing works...

  • Error in calling SQL plus program with parameter from Shell script

    This is my Shell script. I am trying to call in the SQL plus program with the parameter and the shell script is registered as a concurrent program.
    PARAMETERS=`echo $1 |tr -d '\"'`
    DB_USER_ID=`echo $PARAMETERS|cut -d" " -f3|cut -d"=" -f2`
    CONN_STRING=$DB_USER_ID
    REQ_DATE=`echo $PARAMETERS|cut -d" " -f9|cut -d"=" -f2`
    timestamp=`date +%m-%d-%y-%H:%M:%S-%Z`
    timestam=`date +%y-%m-%d`
    sqlplus -s $CONN_STRING @ar_statement.sql $REQ_DATE
    chmod 755 statement.sh
    . statement.sh
    My Sql plus program is like this.
    set pagesize 0
    set heading off
    set feedback off
    spool $GEC_TOP/log/ge_ar_statement.sh
    select output_file_name
    from fnd_concurrent_requests
    where trunc(actual_completion_date) = '&2';
    spool off;
    exit;
    When i run the concurrent program, i am getting the following error:
    ar_statement: line 14: REQ_DATE: command not found
    Enter value for 2:
    User requested Interrupt or EOF detected.
    ar_statement.sh: line 1: Enter: command not found
    ar_statement.sh: line 2: User: command not found
    ar_statement
    Program exited with status 127
    I am not strong at Unix Porgamming and i would request someone who can
    help me out as soon as possible.
    I need this solution quickly and thank everyone in advance.
    Thanks.

    Can you put your coding between code statements, like shown in the FAQ. It will be easier to read.
    Looking at your script, my first guess is that crontab will not find your sqlplus since your script does not have $HOME/bin in the $PATH. From what I understand, running .profile in your script will not work either because variables are exported to sub-shells, not to the shell above. You can call your script with a dot like . ./script which means that the script will run like it was typed at the command prompt. But it will be less confusing to define appropriate variables in the script. eg.
    ORACLE_SID=my_instance_name
    ORACLE_HOME=/my_path_to_oracle_home_directory
    LD_LIBRARY_PATH=$ORACLE_HOME/lib
    PATH=$ORACLE_HOME/bin:$PATH
    I remember some slightly different way of coding to handle the sqlplus return codes.
    For instance:
    sqlplus -s /nolog > /dev/null <<-EOF
    connect system/manager
    @ssm.sql
    whenever oserror exit failure
    whenever sqlerror exit failure
    EOF
    sql_err=$?
    if [ $sql_err -ne 0 ]; then
       echo "FAILURE"
    else
       echo "SUCCESS"
    fiThe - in -EOF supresses tab's
    Using connect will prevent ps from showing your login credentials
    In some versions of bash the ending EOF needs to be at the beginning of the line to work.
    Edited by: waldorfm on Jul 14, 2010 7:05 PM
    complaining about putting code between code delimiters and forgot myself ;-)
    Edited by: waldorfm on Jul 14, 2010 7:08 PM
    Btw, if you "source" a script running it like . .script, than an exit in that script will log you out.

Maybe you are looking for

  • Webcam Live - Unable to capture Video when "audio" is on

    Unable to capture Video when "audio" is checked. Error message "Unable to capture Video - check settings for video compressor and Audio compressor". What are these ?? I have Plantronics headset and have tried most "8bit, mono settings" Capture Video

  • 8330 Can you manually edit the Address book contacts on a PC using Desktop Manager?

    I am converting from a iDEN phone and have my contact list in .mdb and .xls format. how can I get this contact list into the BlackBerry Address Book? It is about 200 contacts.

  • Reporting Agent

    Hello, We are trying to implement Reporting based on precalculated web templates. the underlying query has variables e.g. Fiscyear-1. If I don't use any variable in the query, i receive a result using a controll query. As soon as a put such a variabl

  • CC Won´t Work, When i open Premiere PRO It Works until i open a project and it closes with no advice

    Well i am REALLY dissapointed so far, i just purchased the CC full for one year and i have not been able to use it. First it asks for ******* serials, already did all the steps in the guides you provide. Now i try to open Premiere Pro CC and it close

  • Migration downtime

    Hi, we are about to migrate an sbs 2003 server to windows server essentials 2012 & I would like to know what downtime this is going to create for the users on the network? Once the new server is onsite, I will run the migration wizard but will THIS P