Ananomous block inside shell script problem

I am having problem using / inside the anonymous block...
I have a shell script which is somethinglike this.
$ORACLE_HOME/bin/sqlplus -s << EOF
--set head off;
--set feedback off;
set serverout on;
Cursor c1 is
select --------
Begin
for x in c1 loop
    Begin
      <do something>
    End;
End Loop;
End;
End;
EOF
mail -s -----If i don't use / certian things are not executed.
If i use exit instead of /, then it will not reach the end ie., the mail part.
can somebody guide me ??

sb92075 wrote:
sunil_dba wrote:
I am having problem using / inside the anonymous block...anonymous blocks begin with
DECLARE
which posted code seems to be lackingOr also a BEGIN if no variables, constants or user types are declared.

Similar Messages

  • Do shell script problem in Applescript

    Hi,
    I am an Applescript novice and have been trying to write a code to go to a particular folder, look for all files in the folder tree with extension .m2v and run an executable file to decode them. My problem is that when I run my code (containing do shell script), it searches through all files and folders on Mac HD and starts decoding .m2v files elsewhere that I don't want.
    Eventually it runs out of space (.m2v file decoding takes a lot of space), because it is dumping all decoded .yuv files onto the HD.
    When I run the command on Terminal, it executes the decoding perfectly and stores the decoded files in the same folder.
    Please help me about what's going on.
    My code is something like:
    tell application "Finder"
    set DestinationFolder to "xxxxxx:xxxx:xxxx"
    set NumFolders to (get count of folders under Destination folder)
    repeat for SomeVar from 1 to NumFolders
    set FolderinQuestion to folder SomeVar of DestinationFolder
    -- Tried tell application "Terminal" here, but did not know --how to export the FolderinQuestion variable from Finder to --Terminal
    do shell script " \" cd \" & (POSIX path of (result as text));
    for file in `find $pwd \"*.mov\"`
    do
    /usr/local/bin/decode file
    done"
    end repeat
    end tell
    I would greatly appreciate some guidance.

    The root of the problem is that you're trying to quote the cd command for some reason:
    <pre class=command>do shell script " \" cd \" & (POSIX path of (result as text));
    ...</pre>
    In addition to that you're including the & (POSIX path of (result as text)) as part of the shell command whereas this should be OUTSIDE of the quotes in order to get evaluated
    If you work that through you'll end up with a shell command that looks like:
    <pre class=command>" cd " & (POSIX path of (result as text))</pre>
    If you try to run that in a terminal you'll get a cd : command not found error and that's why the rest of it appears to fail.
    The solution to that one is simple - just don't bother quoting the cd and put the POSIX path stuff outside of the quotes to get it evaluated at runtime:
    <pre class=command>do shell script "cd " & quoted form of POSIX path of (FolderInQuestion as text)) & ";
    # rest of shell commands here"</pre>
    Now, as for the rest of the script there are a few things I would change.
    First, unless you need to know the index, don't do:
    >repeat for SomeVar from 1 to NumFolders
    set FolderinQuestion to folder SomeVar of DestinationFolder
    the issue is that the number of folders to process may change during the script's execution (other processes may create or remove folders). This will, at best, cause some folders to be skipped and, at worst, cause the script to fail.
    If you're iterating through a list, the best option is to just:
    <pre class=command>repeat with FolderInQuestion in (folders of DestinationFolder)
    ...</pre>
    This automatically sets the iterator (in this case, FolderInQuestion, to the first item in the list and increments it for each iteration through the loop.
    Secondly, in your shell script itself, scrub the entire do/done loop. You're already using find, so have that do the hard work using the -exec switch:
    <pre class=command>find path -name "*.mov" -exec /usr/local/bin/decode {} \;</pre>
    In find's case, {} is substituted with the current file's path.
    Putting this together you'd get:
    <pre class=command>tell application "Finder"
    set DestinationFolder to "xxxxxx:xxxx:xxxx"
    repeat with folderInQuestion in (get folders of folder DestinationFolder)
    do shell script "cd " & quoted form of POSIX path of folderInQuestion & "; find . -name \"*.mov\" -exec /usr/bin/decode {} \\;"
    end repeat
    end tell</pre>
    Note that I've used 'quoted form of POSIX path' - this takes care of any shell-unsafe characters like spaces in the path name. I've also used \\; for the -exec switch - this is so that AppleScript passes the \ to the shell command rather than using it for its own escaping.
    But you're not done yet!
    There's still one fatal flaw in this process - and that is the fact that find by default, is recursive - it will walk through every directory that it finds.
    This means that if you start at the top folder and iterate through, find will find all .mov files and decode them. Your script then cd's to the first subdirectory and repeats the process - decoding all the .mov files in that directory and all its subdirectories even though they've ALREADY been decoded.
    The upshot is that you only need to run one loop starting at the top level. You don't need to iterate through all the subdirectories since find will do that for you.
    In addition to that, there might not be a need to use cd at all since the first argument to find is the directory to start searching in. Unless there's some reason that you need to start decode from the top level directory (e.g. is that where it saves the files?), you can drop the whole repeat loop altogether and just run with:
    <pre class=command>set startFolder to (choose folder)
    do shell script "find " & quoted form of posix path of startFolder & " -name \"*.mov\" -exec /usr/bin/decode {} \\;"</pre>
    That's the entire script - a radical compression of your original.

  • Executing native library under Java - shell script problem

    I am running a Java application on the command line bash shell. I have a few JAR files in the directory and a few native libraries. When I run the application using the command line, all works fine. This is the command I use:
    java -classpath MyGame.jar:log4j-1.2.16.jar:jme/jme-colladabinding.jar:jme-audio.jar:jme-awt.jar:jme-collada.jar:jme-editors.jar:jme-effects.jar:jme-font.jar:jme-gamestates.jar:jme-model.jar:jme-ogrexml.jar:jme-scene.jar:jme-swt.jar:jme-terrain.jar:jme.jar:jogl/gluegen-rt.jar:jogl/jogl.jar:jorbis/jorbis-0.0.17.jar:junit/junit-4.1.jar:lwjgl/jinput.jar:lwjgl/lwjgl.jar:lwjgl/lwjgl_util.jar:lwjgl/lwjgl_util_applet.jar:swt/windows/swt.jar:jbullet/jbullet-jme.jar:jbullet/asm-all-3.1.jar:jbullet/jbullet.jar:jbullet/stack-alloc.jar:jbullet/vecmath.jar:trove-2.1.0.jar:sceneMonitor/jmejtree_jme2.jar:sceneMonitor/propertytable.jar:sceneMonitor/scenemonitor_jme2.jar:sceneMonitor/sm_properties_jme2.jar -Djava.library.path="lwjgl/native/linux" -Xmx1024m -Xms768m -ea com.mygame.MainThis works fine and the application starts up as expected. LWJGL native library is loaded in and works fine as expected.
    The problem occurs when I try to run this command via the shell using a shell script. Here is my script:
    #!/bin/bash
    # Set the minimum and maximum heap sizes
    MINIMUM_HEAP_SIZE=768m
    MAXIMUM_HEAP_SIZE=1024m
    if [ "$MYAPP_JAVA_HOME" = "" ] ; then
        MYAPP_JAVA_HOME=$JAVA_HOME
    fi
    _JAVA_EXEC="java"
    if [ "$MYAPP_JAVA_HOME" != "" ] ; then
        _TMP="$MYAPP_JAVA_HOME/bin/java"
        if [ -f "$_TMP" ] ; then
            if [ -x "$_TMP" ] ; then
                _JAVA_EXEC="$_TMP"
            else
                echo "Warning: $_TMP is not executable"
            fi
        else
            echo "Warning: $_TMP does not exist"
        fi
    fi
    if ! which "$_JAVA_EXEC" >/dev/null ; then
        echo "Error: No Java environment found"
        exit 1
    fi
    _MYAPP_CLASSPATH="MyGame.jar:log4j-1.2.16.jar:jme/jme-colladabinding.jar:jme-audio.jar:jme-awt.jar:jme-collada.jar:jme-editors.jar:jme-effects.jar:jme-font.jar:jme-gamestates.jar:jme-model.jar:jme-ogrexml.jar:jme-scene.jar:jme-swt.jar:jme-terrain.jar:jme.jar:jogl/gluegen-rt.jar:jogl/jogl.jar:jorbis/jorbis-0.0.17.jar:junit/junit-4.1.jar:lwjgl/jinput.jar:lwjgl/lwjgl.jar:lwjgl/lwjgl_util.jar:lwjgl/lwjgl_util_applet.jar:swt/windows/swt.jar:jbullet/jbullet-jme.jar:jbullet/asm-all-3.1.jar:jbullet/jbullet.jar:jbullet/stack-alloc.jar:jbullet/vecmath.jar:trove-2.1.0.jar:sceneMonitor/jmejtree_jme2.jar:sceneMonitor/propertytable.jar:sceneMonitor/scenemonitor_jme2.jar:sceneMonitor/sm_properties_jme2.jar"
    _VM_PROPERTIES="-Djava.library.path=\'lwjgl/native/linux\'"
    _MYAPP_MAIN_CLASS="com.mygame.Main"
    $_JAVA_EXEC -classpath $_MYAPP_CLASSPATH $_VM_PROPERTIES -Xmx${MAXIMUM_HEAP_SIZE} -Xms${MINIMUM_HEAP_SIZE} -ea $_MYAPP_MAIN_CLASSThe shell script is in the same directory as the JAR files (the same directory where I ran the Java command above). When I execute the shell script ( sh MyGame.sh ), I get the UnsatisfiedLinkError message:
        14-Feb-2011 19:46:28 com.wcg.game.DefaultUncaughtExceptionHandler uncaughtException
        SEVERE: Main game loop broken by uncaught exception
        java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
           at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1734)
           at java.lang.Runtime.loadLibrary0(Runtime.java:823)
           at java.lang.System.loadLibrary(System.java:1028)
           at org.lwjgl.Sys$1.run(Sys.java:73)
           at java.security.AccessController.doPrivileged(Native Method)
           at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
           at org.lwjgl.Sys.loadLibrary(Sys.java:82)
           at org.lwjgl.Sys.<clinit>(Sys.java:99)
           at org.lwjgl.opengl.Display.<clinit>(Display.java:130)
           at com.jme.system.lwjgl.LWJGLDisplaySystem.setTitle(LWJGLDisplaySystem.java:118)
           at com.wcg.game.WcgStandardGame.initSystem(WcgStandardGame.java:287)
           at com.wcg.game.WcgStandardGame.run(WcgStandardGame.java:185)
           at java.lang.Thread.run(Thread.java:662)I don't understand what I am doing wrong. I am executing the exact same command via a shell script and it is not working. Any ideas, solutions, most welcome.
    I am running Linux Mint Debian 201012, Linux mint 2.6.32-5-amd64 #1 SMP Thu Nov 25 18:02:11 UTC 2010 x86_64 GNU/Linux. JDK is 1.6.0_22 64-bit. I have 64-bit .so files in the correct place too.
    Thanks
    Riz

    Thanks for the replies guys/gals.
    I have modified the script and echoed my command that should be running under the shell script, it is:
    java -classpath WcgFramework.jar:WcgPocSwordplay.jar:log4j-1.2.16.jar:jme/jme-colladabinding.jar:jme-audio.jar:jme-awt.jar:jme-collada.jar:jme-editors.jar:jme-effects.jar:jme-font.jar:jme-gamestates.jar:jme-model.jar:jme-ogrexml.jar:jme-scene.jar:jme-swt.jar:jme-terrain.jar:jme.jar:jogl/gluegen-rt.jar:jogl/jogl.jar:jorbis/jorbis-0.0.17.jar:junit/junit-4.1.jar:lwjgl/jinput.jar:lwjgl/lwjgl.jar:lwjgl/lwjgl_util.jar:lwjgl/lwjgl_util_applet.jar:swt/windows/swt.jar:jbullet/jbullet-jme.jar:jbullet/asm-all-3.1.jar:jbullet/jbullet.jar:jbullet/stack-alloc.jar:jbullet/vecmath.jar:trove-2.1.0.jar:sceneMonitor/jmejtree_jme2.jar:sceneMonitor/propertytable.jar:sceneMonitor/scenemonitor_jme2.jar:sceneMonitor/sm_properties_jme2.jar -Djava.library.path="lwjgl/native/linux" -Xmx1024m -Xms768m -ea com.mygame.MainI am more confident that now the shell script should be fine (I am a shell script noob) because this very command if I copy from terminal and paste into the terminal, runs the application no problem at all. But I am amazed that it is still not working. I must be doing something obviously wrong. :-(
    I used the code as suggested:
    _VM_PROPERTIES='-Djava.library.path="lwjgl/native/linux"'I am stumped!? :-(
    Thanks for help.

  • Sqlldr ops$user/password in a shell script - problem

    Hello All:
    i run the sqlldr command from a unix shell script that has
    sqlldr ops$user/password@alias control='/path1/control.ctl' log='/path2/log.log'
    I am geeting invalid user/password because of the $ sign in the username. What is the workaround for this? How to handle this in the script?
    I tried single quote, USERID= unsuccessfully. Any ideas?
    Thanks
    San~

    Hello,
    Single quote should work fine , can you post your shell script specially couple of line and try connecting from command line.
    $ sqlplus 'test$user'/*****
    SQL*Plus: Release 10.2.0.1.0 - Production on Tue Apr 14 14:36:04 2009
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options
    SQL> exit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine optionsRegards
    Edited by: OrionNet on Apr 14, 2009 2:38 PM

  • Simple shell script problem...

    I am trying to get a list of directories on a remote machine, compare them with the directories on the local machine and copy any that dont match on the local machine to a backup folder. Heres my code but i am a newbie and i cant get my shell script to read from a file. The for loop never executes so i am guessing i am not reading the file correctly - see below.
    #!/bin/ksh
    ssh -l removeserver 192.168.xxx.xxx ls /remote/server/directory/ > /store/remote/directory/listing/motapp1files.txt
    newfile=''
    $newfile < /store/remote/directory/listing/motapp1files.txt
    for file in $newfile;
    do echo $file
    if [ ! -d local/machine/directories/$file/ ]; then
    echo "this folder doesnt exist on on remote server "; echo $file;
    fi
    done

    Re-inventing the wheel perhaps. Look into rsync. Great program!
    I used it in FreeBSD to do a very similar task.

  • Rman shell script problem

    Hello,
    While running the following rman commands directly from the shell , its work fine :
    $ rman CATALOG=catman/man@rman TARGET=/
    RMAN> run {
    2>   allocate channel 'dev_1' type 'sbt_tape'
    3>   parms  'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=bz,OB2BARLIST=bz_archive,OB2BARHOSTNAME=bz)';
    4>   allocate channel 'dev_2' type 'sbt_tape'
    5>   parms  'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=bz,OB2BARLIST=bz_archive,OB2BARHOSTNAME=bz)';
    6>   restore archivelog from time "to_date('2011-02-14 08:31:55','YYYY-MM-DD HH24:MI:SS')" until time 'SYSDATE';
    7>     }
    allocated channel: dev_1
    channel dev_1: sid=323 devtype=SBT_TAPE
    channel dev_1: Data Protector A.06.11/243
    allocated channel: dev_2
    channel dev_2: sid=438 devtype=SBT_TAPE
    channel dev_2: Data Protector A.06.11/243
    Starting restore at 2011-02-14 19:01:38
    ....When trying to run it as shell script :
    #!/bin/ksh
    ssh -l oracle 172.22.xx.xx . /software/oracle/.profile ;
    export NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'
    rman CATALOG=catman/man@rman TARGET=/
    run {
       allocate channel 'dev_1' type 'sbt_tape'
       parms  'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=bz,OB2BARLIST=bz_archive,OB2BARHOSTNAME=bz)';
       allocate channel 'dev_2' type 'sbt_tape'
       parms  'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=bz,OB2BARLIST=bz_archive,OB2BARHOSTNAME=bz)';
       restore archivelog from time "to_date('2011-02-14 08:31:55','YYYY-MM-DD HH24:MI:SS')" until time 'SYSDATE';
       }The script succeded to connect to rman but it stuck hir:
    $ ./yoav.sh  
    Recovery Manager: Release 10.2.0.4.0 - Production on Mon Feb 14 20:13:41 2011
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    connected to target database: BZ (DBID=3044220964)
    connected to recovery catalog database
    RMAN> Any suggestion why it stuck ?
    Thanks

    It is stucked because RMAN it waiting input on STDIN and you don't give anything as input to STDIN.
    Try to use
    $ rman CATALOG=catman/man@rman TARGET=/ <<EOF
    <your RMAN script>
    EOFor try to use RMAN command file like a SQL file:
    http://download.oracle.com/docs/cd/B19306_01/backup.102/b14192/setup001.htm#sthref206
    Edited by: P. Forstmann on 14 févr. 2011 20:05

  • Execute immediate will work in SQL Block in shell script?

    Hi Friends,
    i am wirting script to get the account id's corresponding to CIF from oracle table and need to pass to procedure.
    Here first_org and last_org are shell variables.
    When i execute the below program it is throwing execute not found.
    Can you please correct me where i made a mistake? and also please let me know how to display some content in below sql block ?dbms_output.put_line or print which need to use and provide me the syntax for both.
    `sqlplus -s crmuser/******@dotis11<<ENDOFSQL
    whenever sqlerror exit 1
    declare
    qstr varchar2(200);
    facid varchar2(20);
    Lacid varchar2(20);
    begin
    qstr:='select ACCOUNTID from accounts where ORGKEY=:1';
    execute immediate qstr into facid using $first_org;
    dbms_output.put_line(facid);
    qstr:='select ACCOUNTID from accounts where ORGKEY=:1';
    execute immediate qstr into Lacid using $last_org;
    dbms_output.put_line(Lacid);
    exec Retail_Otu_Dedup_Account(facid,Lacid)
    end;
    exit;
    ENDOFSQL`
    Thanks,
    Venkat Vadlamudi.

    Hi SY,
    I Included set serveroutput on but i didn't include single quotes for shell variable in execute immediate.
    Now iam able to execute and getting proper o/p.
    Thanks SY for your help...
    and how to print shell variable in above sql block..i tried like this. but throwing error.
    dbms_output.put_line('$first_org');
    dbms_output.put_line('VCIF1320');
    ERROR at line 5:
    ORA-06550: line 5, column 12:
    PLS-00103: Encountered the symbol "." when expecting one of the following:
    constant exception <an identifier>
    *<a double-quoted delimited-identifier> table long double ref*
    char time timestamp interval date binary national character
    nchar
    The symbol "<an identifier>" was substituted for "." to continue.
    ORA-06550: line 6, column 5:
    PLS-00103: Encountered the symbol "=" when expecting one of the following:
    constant exception <an identifier>
    *<a double-quoted delimited-identifier> table long double ref*
    char time timestamp interval date binary national characte
    Thanks,
    Venkat Vadlamudi.

  • Shell script question

    Hi all,
    I know this is a little bit off subject but i have a shell scripting problem and was wondering if any of you could help...
    so:
    L=`wc -l $CATALINA_HOME/webapps/EmailSignup/Data/add.txt`
    stores the number of lines some file has...
    eg output:0 /usr/local/tomcat4/webapps/EmailSignup/Data/add.txt
    so now i want to have an if statement that will compare to see if the number of lines are equal to zero...
    how can i do that... this is what i do but it never seems to go in the if...
    it always goes in the else..
    if [ "$L" == " 0 /usr/local/tomcat4/webapps/EmailSignup/Data/add.txt" ] ;
    then
    echo $L
    echo No additions to the Email List
    else
    echo --$L
    echo Adding new entries to the Email List
    fi
    any ideas?
    thanks
    udam

    Try using the '-eq' operator of the 'test' program. (Square [] brackets in a Bourne shell script invoke the '/bin/test' program for your convenience. See the man page for 'test' for more info.)
    '-eq' compares two values NUMERICALLY, while '==' compares two values as STRINGS.
    Oops, I see what the other poster said about the leading space. What you really need to do is cut the number out of the string. You don't care about the file name.
    if [ `echo "$L" | cut -c 1-7` -eq 0 ] ;
    then
      echo $L
      echo No additions to the Email List
    else
      echo --$L
      echo Adding new entries to the Email List
    fi

  • Calling a sql in shell script

    Dear All,
    I want to call an sql script within a unix shell script. I want to pass a parameter into the shell script which should be used as a parameter in teh sql script.
    e.g
    $ ./shell1.sh 5000129
    here 5000129 is a prameter
    inside shell script i am calling one sql script
    e.g.
    @script1.sql;
    inside the sql script I have an update statement
    UPDATE abc set xx = 22 where id = 500129;
    as you can see the 5000129 passed as shell script parameter, is being passed as parameter in the sql script.
    Please can you advise how can I achieve this?
    Many Thanks,

    Hi
    You could try something like this.
    tmpSQLFile=$EXTLOG_DIR/tmpSQLFile_$$.sql
    tmpSpoolFile=$EXTLOG_DIR/tmpSpoolFile_$$.sql
    export ORACLE_PWD=`cat /home/oracle/secure/runtime_user.dat`
    echo "spool $_tmpSpoolFile" > $_tmpSQLFile
    echo "SET ECHO OFF NEWP 0 SPA 0 PAGES 0 FEED OFF HEAD OFF TRIMS ON LINESIZE 10000 TIMING OFF" >> $_tmpSQLFile
    echo "begin" >> $_tmpSQLFile
    echo "DW_MGT_SCHEMA.PKG_RUNTIME_HANDLER.SP_UPD_RUNTIME_EXT_CTL_LOG_TDT(p_transfer_date => '$today', p_schedule_id => $schedule_id);" >> $_tmpSQLFile
    echo "end;" >> $_tmpSQLFile
    echo "/" >> $_tmpSQLFile
    echo "exit" >> $_tmpSQLFile
    sqlplus ${ORACLE_USER}@${ORACLE_SID} @$_tmpSQLFile << EOT
    `echo $ORACLE_PWD`
    EOTCheers
    Gary

  • Problem-Report generation using shell script

    Hi
    We have the Production database and the Reporting database (copy of Production database),
    both on Oracle 9.2.0.5 and Solaris 5.8. There is a package inside the Oracle database, which extracts some data from inside the
    database, and would generate a report. A shell script has been created in Solaris which would
    send in the parameters and call the pakage to generate the report. The parameters it is sending is
    the name of report to be generated, and the location where it is to be generated, both hard-coded into
    the script. The script is scheduled to run through crontab.
    The problem we are facing is that, if we run the script for Reporting database, it successfully
    generates the report. But if we use that script for Production database, it gives the error
    "Invalid directory Path". I have tried using various other directory paths, even '/tmp'
    and '/', but it still gives the same error when executed for Production dataabse.
    Could somebody provide any ideas what might be going wrong.
    The reasons it is to be executed on Prod db and not the Reporting database are unavoidable.
    It anyway runs in off business hours and takes about 10secs to execute.
    Please do let me know if there is any other info that I missed to provide here.
    Thanks in advance...

    I will be just guessing because you didn't provide contents of script and package.
    The "Invalid directory path" as you said could be ORA-29280 due non existent directory.
    Try execute (as sys or system) select * from dba_directories; (or select * from all_directories; as user which the script is login to) on both databases and compare the results. If there is missing your important directory then create it using create directory <dirname>; (from sqlplus and don't forget to grant rights for user).
    This error could come from shell script. In that case you should find resolution yourself because you didn't provide script source.

  • 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.

  • Problems with executing shell script within oracle procedure

    I have procedure that's owned by Semantic user. This procedure calls job scheduler (owned by USER1) which in turn executes a shell script load_semantic.sh (owned by USER1).
    Now, there is a shell script(checkCount.sh)inside of this one (owned by this USER1) that has following contents:
    checkCount.sh
    #!/bin/bash
    MODEL=$1
    sqlplus -S user/pass << EOF
    whenever sqlerror exit 1;
    set echo on
    set verify off
    MERGE INTO SEMANTIC.COUNT_STATISTICS s
    USING (SELECT '$MODEL' AS MODEL, 0 AS NEW_COUNT, SYSDATE AS NEW_DATE, 0 AS OLD_COUNT, SYSDATE AS OLD_DATE FROM dual) t
    on (s.MODEL = t.MODEL)
    when not matched then
    INSERT (s.MODEL, s.NEW_COUNT, s.NEW_DATE, s.OLD_COUNT, s.OLD_DATE)
    VALUES (t.MODEL, t.NEW_COUNT, t.NEW_DATE, t.OLD_COUNT, t.OLD_DATE);
    COMMIT;
    UPDATE SEMANTIC.COUNT_STATISTICS SET  MODEL = '$MODEL', NEW_COUNT = (SELECT COUNT(*) FROM TABLE(SEM_MATCH('{?s ?p ?o}',SEM_Models('$MODEL'),NULL,SEM_ALIASES(SEM_ALIAS('','http://VISION/DataSource/SEMANTIC#')),NULL)) ),NEW_DATE  = SYSDATE,
    OLD_COUNT = NEW_COUNT, OLD_DATE  = NEW_DATE WHERE MODEL = '$MODEL' AND NEW_DATE = (select max(NEW_DATE) from SEMANTIC.COUNT_STATISTICS where MODEL = '$MODEL');
    COMMIT;
    exit;
    EOF
    So when I execute SEMANTIC.PROCEDURE:
    SEMANTIC.PROCEDURE => USER1.JOBSCHEDULER =>USER1.load_semantic.sh =>USER1.checkCount.sh
    It never populates the table SEMANTIC.COUNT_STATISTICS.
    I tried giving all of the permissions but I am probably missing something...
    Maybe fresh eyes can see something that I can't.

    I can't believe I am going to say this but the reason it was not working was because I removed oracle environment path from my script by mistake.
    . /etc/profile.d/oracle.sh
    Ugh...
    Now it is working perfectly.
    Btw, sqlplus does know about shell environment variables.
    THANK YOU GUYS!!! YOU ARE THE BEST!!!!!!!!!!!!!!!!!!
    I ONLY HAVE YOU TO TALK TO WHEN I AM STUCK ON A PROBLEM.

  • Problem with running Bash shell scripts

    I am unable to run Bash shell scripts on the UNIX Terminal application.
    This is the transcript from the Terminal application.
    Zhi-Yang-Ongs-Computer:/Applications/MetaPost/metapost-1.102 zhiyangong$ ./test1.sh
    dyld: Symbol not found: _BC
    Referenced from: /usr/local/bin/bash
    Expected in: /usr/lib/libSystem.B.dylib
    Trace/BPT trap
    Zhi-Yang-Ongs-Computer:/Applications/MetaPost/metapost-1.102 zhiyangong$
    Is this a problem with the the default installation of the Bash shell? Can I install the Bash shell on my own? If so, how can I do that?
    Also, how can I get the dynamic linker, dyld, to refer to the symbol "_BC"? What does this symbol "_BC" refer to?

    This was in your posted output:
    /usr/local/bin/bash
    You are NOT running the default bash, you are trying to run a private copy.
    The default Mac OS X bash is located at
    /bin/bash
    Try the following:
    /bin/bash ./test1.sh
    Does that work?
    What is the first line of your script? Is it:
    #!/bin/bash
    Or maybe
    #!/usr/bin/env bash
    /usr/bin/env would find the first bash in PATH . I find this most useful for finding perl on different systems, but sh, ksh, bash, zsh, csh, tcsh are all generally found in /bin so I do not bother using /usr/bin/env
    And if you have
    #!/usr/local/bin/bash
    Then the person that wrote test1.sh choose to use something besides the default bash
    Or maybe this script was transferred from some system where you needed to put your own copy of bash in /usr/local/bin because the vendor does not distribute bash
    Then again, you have not showed us what is inside your script, so it is possible something in the script called something else which invoked the /usr/local/bin/bash
    If that is the case, then you might try:
    /bin/bash -x ./test1.sh
    which should show you the commands executed before it died.

  • Problem with shell script

    The Startup file contain following lines.
    Cd $oracle_home
    Cd cd dbs
    ORACLE_SID=tmp
    export ORACLE_SID
    svrmgrl >> EOF trial.log
    connect internal
    startup PFILE=inittmp.ora
    disconnect
    exit
    cd /
    EOF trial.log
    $ sh startup
    after it is going to loop by pressing ctrl c or ctrl z it is comming out.
    What's wrong with this.
    Can any body help me regarding this script.
    null

    1) If you have access to a Windows machine , run the problematic query in windows 'rwrun' and see whether there is any output That way we can find out whether this a 'shell' related problem . [ ie the way cmd lines are passed ]
    2) Backup and Edit the rwrun.sh script . There you can see
    rwrun $* # or something to this effect
    Instead of '$*' , put your command line args inside directly .
    Then just simply run using rwrun.sh < no args >
    Again , this is to see whether this problem is due to the way shell handles parameters
    3) You can even try setting env variables [ as in reports.sh ] and trying 'rwrun' in shell prompt itself
    rwrun <.....> # no .sh
    4) Please consult SuSe shell docs and see whether % [ or may be ' and \ ] has any special meaning.
    Thanks
    The Oracle Reports Team

  • How to delete a DAC block inside a sub-block by using script?

    Hello,
    how can I delete a DAC block that’s inside a sub-block diagram using a script?
    The command
    call SCHEMELOAD("xxx")
    call BlDel("yyy")
    only deletes blocks that are in the highest level of the actually loaded block diagram, not blocks that are in a sub-block diagram. (DIAdem 2012)
    regards,
    Eric

    Hi Walter,
    I don't need to delete a sub-block, I'd only like to delete blocks which are placed inside a sub-block.
    All other commands I tried work for blocks no matter where they are inside a block diagram. For exaple: You can put a math formula block inside a sub-block wich is inside a sub-block which is inside a sub block and it does change the formula by script command.
    But when using the command Bldel it deletes all blocks but not the ones inside a sub-block.
    regards, Eric

Maybe you are looking for