Invoking a Package.Procedure via bash shell script

Hello All,
I am using the below syntax to call package in a unix shell script, is this right way of calling and checking for errors or is there any other better approach?? kindly suggest.
I am using Oracle 11g & Linux OS, SQL*Plus: Release 11.2.0.3.0 Production
   RETVAL=`sqlplus -s FCSDWH_STG/${DBSTG}@${DBSRC} <<EOF
        EXEC FCSDWH_STG.FCA_HASH_TOTALS_PKG.HASH_TOTALS_COMPUTE(${PROVIDER},${UNINUM},${EXTRACT_DT},${VER_NUM});
        EOF`
        if [ `echo ${RETVAL} | egrep "ERROR"` ]
        then
                logit "Error While Generating The SQLPLUS Output File, Please Check"
                exit 1
        else
                logit "SQLPLUS Output File Has Been Generated Successfully"
        fiThanks much.

Ariean wrote:
I am testing the same above functionality with the below sample procedure, and I am purposefully making it compile erroneous with "dbms_output.put_lin" just for sake of testing.
create or replace
procedure today_is as
begin
dbms_output.put_lin('Today is : ' || to_char(sysdate,'DL'));
end today_is;This is sample shell script "test.sh" I am using
#!/bin/bash
RETVAL=`sqlplus -s FCSDWH_STG/FCSDWH_STG@dwdev <<EOF
set termout off
exec today_is;
EOF`
echo "start here"
echo ${RETVAL}
echo "end here"
if [ `echo "$RETVAL" | grep "ERROR"` ]
then
echo "Error While Generating The SQLPLUS Output File, Please Check"
exit 1
else
echo "SQLPLUS Output File Has Been Generated Successfully"
fiBelow is my output
start here
BEGIN today_is; END;
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00905: object FCSDWH_STG.TODAY_IS is invalid
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
end here
/home/infrmtca/bin/test.sh: line 8: [: too many arguments
SQLPLUS Output File Has Been Generated SuccessfullyI don't understand why it is printing "SQLPLUS Output File Has Been Generated Successfully" though it errored out.Because statements within backquotes are executed before the statement calling the backquote. The [ command has too many arguments coming from the echo and grep.  You might put just that test part of the script in it's own little script and test it, it seems to say that whether there is an ERROR in $RETVAL or not.  You might need to man test and see if you need a -z argument or something.
>
Edited by: Ariean on May 15, 2013 10:08 AM
Edited by: Ariean on May 15, 2013 10:16 AM

Similar Messages

  • Invoking a bash shell script from Java code

    Hi All
    I am trying to invoke a Bash shell script using java code. The arguments required are "source wmGenPatch <source dir> <destination dir> no_reverse.
    in the code I have specified the arguments considering the cannonical paths of the files as the code may run on Unix or windows platform.
    I am getting a error while invoking Runtime.getRuntime().exec(args). The error is as follows :
    "The Error Occurred is: CreateProcess: source D:\Package4.0\workspace\DiffEngineScripts\v4a02\wmGenPatch D:\Package4.0\workspace\fromImageFilesDir\ D:\Package4.0\workspace\toImageFilesDir\ no_reverse error=2"
    It seems that error=2 indicates that the 'file not found' exception. But i can see the directories referred to in the error at place in the workspace.
    Kindly advice.
    Thanks in advance.

    Hi All
    I am pretty new to invoking bash shell scripts from java and not sure if i am progressing in right direction.
    The piece of code tried by me is as follows
    try {
                   currentDir = f.getCanonicalPath();
              } catch (IOException e) {
              if (currentDir.contains("/")) {
                   separator = "/";
              } else {
                   separator = "\\";
              String args[] = new String[7];
              args[0] = "/bin/sh";
              args[1] = "-c";
              args[2] = "source";
              args[3] = currentDir + separator + "DiffEngineScripts" + separator
                        + "v4a02" + separator + "wmGenPatch";
              args[4] = sourceFileAdd;
              args[5] = destFileAdd;
              if (isReverseDeltaRequired) {
                   args[6] = "reverse";
              } else {
                   args[6] = "no_reverse";
              try {
                   Process xyz = Runtime.getRuntime().exec(args);                              
                   InputStream result = xyz.getInputStream();
                   InputStreamReader isr = new InputStreamReader(result);
                   BufferedReader br = new BufferedReader(isr);
                   String line = null;
                   while ( (line = br.readLine()) != null)
                        System.out.println(line);
                   int exitVal = xyz.waitFor();
                   System.out.println("Leaving Testrun.java");
              } catch (Throwable t) {
                   t.printStackTrace();               
    and on running the same i am getting Java.io.IOException with the stack trace
    java.io.IOException: CreateProcess: \bin\sh -c source D:\Package4.0\workspace\DiffEngineScripts\v4a02\wmGenPatch D:\Package4.0\workspace\fromImageFilesDir\ D:\Package4.0\workspace\toImageFilesDir\ no_reverse error=3
    kindly advice
    Thanks in advance

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

  • How can i call a Stored Procedure procedure from Unix shell script

    Hi All,
    I want to call a Strored PL-SQL Procedure through Unix shell script.
    Can any body help me with this.
    Regards,
    Saurabh

    I prefer a seperate script like the other poster mentioned. However, most shells can use a 'here' document as well ...
    sqlplus uid/pwd <<END
    exec myproc
    exit
    ENDRichard

  • Calling stored procedure from unix shell script

    Hello,
    I am facing a problem while calling a stored procedure from UNIX shell script. I want to return a output variable from the stored procedure to the UNIX environment.
    Here is the code-
    #!/bin/sh
    OUTPUT=`sqlplus cmag/magnum@dw <<ENDOFSQL
    set serveroutput on;
    var prd_out varchar2(100);
    exec create_pm_window(:prd_out);
    exit;
    ENDOFSQL`
    echo " output is - $OUTPUT"
    The problem is :prd_out is not getting copied to shell variable OUTPUT.
    I have a dbms_output.put_line in the stored proc create_pm_window and I can see that prd_out is getting populated.
    Any help is really appreciated.
    Thanks'
    Rakhee

    First step :
    make sure the PL/SQL works as expected.
    Does the following display the expected output executed from SQL*Plus ?
    set serverout on
    declare
    prd_out varchar2(100);
    begin
    create_pm_window(prd_out);
    dbms_output.put_line('output is '||prd_out);
    end;
    I don't have your procedure, but using a dummy procedure like :
    Scott@my10g SQL>create procedure foo(p_out in out varchar2)   
      2  is
      3  begin
      4  select 'Hello '||instance_name into p_out from v$instance;
      5  end;
      6  /
    Procedure created. and a toto.sh script as :OUTPUT=`sqlplus -s scott/tiger <<EOF
    set pages 0 lines 120 trimout on trimspool on tab off echo off verify off feed off serverout on
    var mavar varchar2(100);
    exec foo(:mavar);
    print mavar;
    exit;
    EOF`
    echo "OUT = ${OUTPUT}"
    exitIt works fine :[oracle@Nicosa-oel ~]$ ./toto.sh
    OUT = Hello my10g

  • Procedure to call shell script which invoke java program

    Hi
    I have requirement for a pl/sql procedure to invokes a shell script which calls java programs.
    I was using DBMS_SCHEDULTER to invoke the shell , the shell is getting invoked but it is not executing the java programs.
    appreciate your suggestions and advices .
    param1=$1
    param2=$2
    #echo "First parameter is:"$1
    #echo "Param1 is:"$param1
    if [ $# -eq 1 ]; then
    java -jar -Xmx512m abc.jar ${CONFIG_DIR} $param1
    elif [ $# -eq 2 ]; then
    java -jar -Xmx512m abc.jar ${CONFIG_DIR} $param1 $param2
    fi
    Regards

    user458361 wrote:
    Hi
    I have requirement for a pl/sql procedure to invokes a shell script which calls java programs.
    I was using DBMS_SCHEDULTER to invoke the shell , the shell is getting invoked but it is not executing the java programs.
    appreciate your suggestions and advices .
    param1=$1
    param2=$2
    #echo "First parameter is:"$1
    #echo "Param1 is:"$param1
    if [ $# -eq 1 ]; then
    java -jar -Xmx512m abc.jar ${CONFIG_DIR} $param1
    elif [ $# -eq 2 ]; then
    java -jar -Xmx512m abc.jar ${CONFIG_DIR} $param1 $param2
    fi
    RegardsYou are doing the equivalent of making THREE Left turns instead of a single Right turn
    Most likely the shell environment is woefully lacking in needed details
    add new line as below
    param1=$1
    param2=$2
    /usr/bin/env | /usr/bin/sort -o /tmp/capture.log
    # make sure above Fully Qualified Pathnames are correct for your system!
    After you invoke script from PL/SQL post content of /tmp/capture.log back here

  • Invoking a servlet from an unix shell script

    I have successfully created a servlet that when loaded via a browser takes input values in a form. After hitting "submit" the results are returned to the browser.
    Now I would like to create an unix shell script that:
    1. takes input values from the command line
    2. invokes the servlet that does the necessary processing
    3. returns the results (via echo, or in a text file, etc.)
    Please give me any clues, hints, directions on
    1. how to convert my existing servlet to accommodate a shell script
    2. how to invoke the script within the shell script
    Please refer me to any existing examples if available.
    Thanks,
    George

    Using the code below as an example I think you are saying I should take the following steps in a java sample program:
    1. in a sample program create an Testservlet object -
    Testservlet newservlet = new Testservlet();
    2. to send input to the servlet execute -
    newservlet.doGet( ? , ? );
    I'm not sure what the parameters should look like
    but I guess one of them is the input value.
    3. to get output from the servlet execute -
    String results = null;
    results = newservlet.doPost( ? , ? );
    Again, I'm not sure what the parameters
    should look like.
    public class TESTservlet extends HttpServlet
    String connPool;
    public void init(ServletConfig config)
    throws ServletException
    super.init(config);
    connPool = getInitParameter("dataSource");
    if (connPool == null) {
    System.err.println("This servlet requires a " +
    " dataSource initArg." );
    public void doPost(HttpServletRequest req,
    HttpServletResponse res)
    throws ServletException, IOException
    // first, set the "content type" header of the response
    res.setContentType("text/html");
    //Get the response's PrintWriter to return text to the client.
    PrintWriter pw = res.getWriter();
    pw.println("test");
    String testinput = null;
    try
    testinput = req.getParameter("testinput");
    catch (Exception e)
    e.printStackTrace();
    pw.println("testinput = " + testinput");
    finally
    pw.close();
    public void doGet(HttpServletRequest req,
    HttpServletResponse res)
    throws ServletException, IOException
    res.setContentType("text/html");
    PrintWriter pw = res.getWriter();
    pw.println("Test Servlet");
    putForm(req, pw);
    pw.println("</body></html>");
    pw.close();
    * putForm() writes an HTML form to the response
    public void putForm(HttpServletRequest req,
    PrintWriter pw)
    throws IOException
    pw.println("<form action=\"" +
    req.getRequestURI() +
    "\" method=post>");
    pw.println("<p><strong>Test Input: </strong>");
    pw.println("<input type=\"text\" " +
    "name=\"testinput\" value=\" \" size=12 maxlength=12>");
    pw.println("<p><input type=\"submit\" " +
    " value=\"Submit Entries\" ");
    pw.println("<p><input type=\"reset\" " +
    " value=\"Clear Entries\" ");
    pw.println("</form>");
    } // END OF SERVLET

  • Unable to pass parameter in oracle procedure through unix shell script

    Hi Experts,
    I have oracle procedure where in I have to pass the value of procedure parameter through unix script.
    Follwoing is the sample procedure which i tried to exceute from the unix.
    Procedure:
    create or replace procedure OWNER.PRC_TESTING_OWNER(OWNER IN VARCHAR2) AS
    sql_stmt varchar2(1000) := NULL;
    v_count number := 0;
    v_owner varchar2(100) := owner;
    begin
    sql_stmt:='select count(1) from '||v_owner||'.EMP@infodb where rownum<=10';
    execute immediate sql_stmt into v_count;
    DBMS_OUTPUT.PUT_LINE(sql_stmt);
    DBMS_OUTPUT.PUT_LINE(v_count);
    END;The script which I used is:
    Unix
    #!/bin/ksh
    parm=$1
    echo start
    sqlplus -s scott@DEV/tiger <<EOF >>result_1.txt
    set serveroutput on;
    select '$parm' from dual;
    exec owner.PRC_TESTING_OWNER('$parm');
    EOFThe script is working fine that is i am able to pass to parameter value through unix shell script. :)
    But if I want to pass the value of the owner in cursor , I am unable to pass this value through unix.
    Following the procedure which i am trying to implement.
    create or replace procedure OWNER.PRC_TESTING_OWNER(OWNER IN VARCHAR2) IS
    v_owner varchar2(100) := owner;
    CURSOR main_cur IS 
      select
      i.ROWID  rid ,
      emp_name,
      deptid
      from v_owner.employee;
    CURSOR subset_cur(c_deptid NUMBER ) IS
        SELECT *
          FROM v_owner.DEPT d
          where  d.dept_id=c_deptid;
    --##main loop     
    FOR i IN main_cur LOOP
          FOR j IN subset_cur(i.deptid) LOOP     
    BEGIN
    insert into v_owner.RESULT_TABLE
    END;
    END LOOP;
    END LOOP;How can i pass parameter value of the stored procedure through unix script(that is "owner" in this case), when these parameter value is
    used in cursor? :(
    Can anybody help me regarding the same?
    Thanks in Advance !! :D

    It's not the parameter in the cursor that is the problem, it's that you are trying to use static SQL for something that won't be known until run time (the owner of the table).
    You would need to use something like ...
    declare
       l_owner        varchar2(30) := 'SCOTT';
       l_ref_cursor   sys_refcursor;  
       type l_ename_tab is table of scott.emp.ename%type;
       l_ename_array  l_ename_tab;
    begin
       open l_ref_cursor for
          'select ename
          from ' || l_owner || '.emp';
       loop
          fetch l_ref_cursor bulk collect into l_ename_array limit 10;
          exit when l_ename_array.COUNT = 0;
          for x in 1 .. l_ename_array.count
          loop
             dbms_output.put_line(l_ename_array(x));
          end loop;
       end loop;
       close l_ref_cursor;
    end;
    SMITH
    ALLEN
    WARD
    JONES
    MARTIN
    BLAKE
    CLARK
    SCOTT
    KING
    TURNER
    ADAMS
    JAMES
    FORD
    MILLER
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.01

  • Procedure call and shell script

    When i try to pass a shell variable to a procedure call in a shell script it does not work. But a SQL command ( insert ) has no problem taking the shell variable. Has this something to do with context switch. How to get around this prbokem.
    `sqlplus <username/password> -silent << EOF
    set serveroutput on size 1000000
    exec procA; -- works
    exec procB($shell_variable); -- does not work
    insert into table1 values ($shell_variable); -- works
    EOF`
    Thanks!

    It works to me :
    TEST@db102 SQL> create or replace procedure isnumeric (num in varchar2)
      2  is
      3          a       number;
      4  begin
      5          a := to_number(num);
      6          dbms_output.put_line (num||' is a number');
      7  exception
      8          when others then
      9                  dbms_output.put_line (num||' is NOT a number');
    10* end;
    11  /
    Procedure created.
    TEST@db102 SQL> exec isnumeric(123);
    123 is a number
    PL/SQL procedure successfully completed.
    TEST@db102 SQL> exec isnumeric('abc');
    abc is NOT a number
    PL/SQL procedure successfully completed.
    TEST@db102 SQL>
    [ora102 work db102]$ cat callvar.sh
    export VAR=$1
    sqlplus -s test/test << EOF
    set serveroutput on size 1000000
    exec isnumeric('$VAR');
    EOF
    [ora102 work db102]$ ./callvar.sh 123
    123 is a number
    PL/SQL procedure successfully completed.
    [ora102 work db102]$ ./callvar.sh abc
    abc is NOT a number
    PL/SQL procedure successfully completed.
    [ora102 work db102]$                       

  • Bash shell script to exception when database has been shutdown

    Hi, I'm quite new in shell scripting. I created the below simple script to do a check on the database, it's a count so it works fine... if the database is there. Now I want to be able to catch if the database is or is not there, what I tried so far didn't work, can anybody please give me a hand with this?
    The shell script file "start_check.sh":
    #!/bin/bash
    # Set environmental variables
    . /home/oracle/env/usrdwh1.env
    TEMP_FILE=rwcnt
    runCheckQuery()
    # Run query and dump result into the TEMP_FILE
    sqlplus -s "/as sysdba" > /tmp/${TEMP_FILE} << EOF
    @/u02/reports/sql/start_check.sql
    EOF
    if [ $? -eq 0 ]
    then err_num=0
    else err_num=1
    fi
    ################ MAIN ####################
    runCheckQuery
    row_count=`cat /tmp/${TEMP_FILE}`
    if [ $err_num -eq 0 ]
    then
    # If no rows were found then send an email alert
    if [ $row_count -eq 0 ]; then
    echo 'No process found - Please investigate' | mailx -s "Daily check ALERT" [email protected]
    fi
    else
    # There was an error when trying to connect to the db. Need to report it
    echo 'Database connection error - Please investigate - Error Message: (' $row_count ')' | mailx -s "Daily check ALERT (Database connection error)" [email protected]
    fi
    # Remove the tmp file
    rm /tmp/${TEMP_FILE}
    The sql script file "start_check.sql":
    SET SERVEROUTPUT ON
    SET FEEDBACK OFF
    WHENEVER SQLERROR EXIT;
    DECLARE
    row_count NUMBER;
    BEGIN
    SELECT COUNT(*)
    INTO row_count
    FROM dw_ml_ba ml_ba
    WHERE sys_id = 'CCX'
    AND ml_ex_start_datetime > TRUNC(sysdate);
    DBMS_OUTPUT.PUT_LINE(row_count);
    END;
    EXIT
    Edited by: leocoppens on Jan 4, 2013 4:05 PM

    There may be a better, but here is a shell script that works:
    #!/bin/ksh
    # db_check.sh
    # Script used to check if one or all of the databases on
    # one server are available.
    # Parameter Description
    sid=$1    # Database SID or Keyword 'all'
    function check1db
    sid=$1    # Database SID
    ORAENV_ASK=NO
    . /usr/local/bin/oraenv "$sid"
    ORAENV_ASK=YES
    if [ $(ps -ef|grep "ora_smon_$sid"|grep -v grep|wc -l) -eq 0 ]
    then
      echo "%-Error, Database $sid is NOT available - Not started\n" >>${CHKLOG}
      return 1
    fi
    dbok=$(\
    sqlplus -s / <<!
    if [[ $(echo $dbok|cut -d' ' -f1 ) == 'ERROR:' ]]
    then
      echo "%-Error, Database $sid is NOT available - Started with errors\n" >>${CHKLOG}
      return 1
    else 
      echo "%-Info, Database $sid is available\n" >>${CHKLOG}
    fi
    return 0
    } # end function check1db
    # Set some environment variables:
    ORACFG=/etc               # Location of oratab
    ORALOG=$HOME/logs         # Location for result log
    EMAIL='[email protected]'  # E-mail to send alert
    sid=${sid:-'all'}
    echo "$0 Job started at: `date` "
    BDATE=$(date +%y%m%d)
    export CHKLOG=$ORALOG/db_check_${sid}_${BDATE}.log
    echo "$0 on `date`" >$CHKLOG
    if [ "$sid" = "all" ]
    then
      i=0
      stat=0
      cat $ORACFG/oratab | while read LINE
      do
        case $LINE in
         \#*)            ;;      #comment-line in oratab
            sid=`echo $LINE | awk -F: '{print $1}'`
            check1db "$sid"
            stat1=$?
            ((stat += $stat1)) # Combine the Status of All Calls
            ((i = $i + 1))     # Count Number of Databases Checked
        esac
      done
      ((j = $i - $stat))  # Count Number of Databases Available
      echo "\n%-Info, `date +%c`,\n\tTotal databases checked = $i,\n\tAvailable = $j, Not available = $stat\n" >>${CHKLOG}
    else
      check1db $sid
      stat=$?
    fi
    # Beep operator if database down.
    if [ ${stat} -ne 0 ]
    then
      SUBJ="Database(s) alert."
      mailx -s"$SUBJ" $EMAIL <$CHKLOG
    fi
    echo "$0 Job stoped at: `date` "
    exit $stat:p

  • I need AD Health status via Power Shell script

    Dear All,
    I need AD Health power shell script and it has to be sent via email as report on daily basis
    Can anyone help on this?
    Thanks,
    Pushparaj

    I found below script which can be used, but i would request run these scirpts in test environment before executing in production.
    http://fearthemonkey.co.uk/using-powershell-to-perform-dc-health-checks/
    http://www.wolffhaven45.com/blog/powershell/automate-some-active-directory-health-checks-via-powershell/
    You can also search for scripts in below repository.
    http://gallery.technet.microsoft.com/
    Also, for scripting related request, its better to post the thread in dedicated scripting/powershell forum.
    http://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?forum=ITCG
    Awinish Vishwakarma - MVP
    My Blog: awinish.wordpress.com
    Disclaimer This posting is provided AS-IS with no warranties/guarantees and confers no rights.

  • Execute stored procedure from Unix shell script

    My current method of executing stored procedures (wpl_1 and wpl_2) from a unix shell script is as follows:
    <<wpl.sh>>
    sqlplus user/password @/home/oracle/scripts/wpl.sql
    <<wpl.sql>>
    set serveroutput on size 1000000
    set timing on
    execute wpl_1('0000010676','~')
    execute wpl_2('0000010676','~')
    execute wpl_1('0000010236','FIX')
    execute wpl_2('0000010236','FIX')
    exit
    Question: Is it possible to combine the two scripts (unix and oracle) together?

    A little rusty on this, but this may work:
    My current method of executing stored procedures
    (wpl_1 and wpl_2) from a unix shell script is as
    follows:
    <<wpl.sh>>sqlplus user/password @/home/oracle/scripts/wpl.sql << EOF
    set serveroutput on size 1000000
    set timing on
    execute wpl_1('0000010676','~')
    execute wpl_2('0000010676','~')
    execute wpl_1('0000010236','FIX')
    execute wpl_2('0000010236','FIX')
    exit
    EOF
    >
    Question: Is it possible to combine the two scripts
    (unix and oracle) together?

  • Port AppleScript to bash shell script

    Hi all,
    I made this script with the help of Neil from these forums. The purpose of the scrip is so that my friend can set up a share point on his NAS which is simply full of links so that if people access the NAS (its full of music and movies) if the delete a link, the file stays where it is.
    The issue he has now, is that when he make the links in MacOS, a Windows system will no follow them. Is there a way around this or should the script be ported to a bash script so that the links can be created internally on his BSD NAS.
    Thanks for any help and suggestions.
    set these_items to (choose file with prompt "Choose files to link:" with multiple selections allowed)
    set link_folder to (choose folder with prompt "Choose folder to place links in:")
    repeat with this_item in these_items
    tell application "Finder" to reveal this_item
    set this_path to the quoted form of the POSIX path of this_item
    set shell_folder to the quoted form of the POSIX path of link_folder
    do shell script "ln -s" & space & this_path & space & shell_folder
    end repeat
    end

    Your issue is one of symlink support, so it won't matter how you create the symlinks.
    First off, which version of Windows are you running?
    Only later versions of Windows (Win7 and, I think Vista) support symlinks, so if you're using anything earlier it won't work.
    Secondly, if you're pointing to a network volume then the target paths have to match, and that's likely to be a problem in cross-platform environments. That's because the symlink file really just contains the path to the target and your paths may be different on each OS.
    For example, On your Mac the sharepoint might be mounted at /Volumes/server and your file might be at /path/file on that share.
    So your symlink file will contain '/Volumes/server/path/file'
    No Windows system is going to be able to follow that path since disks aren't mounted under /Volumes. You would either have to know that share's current mount point or use a Windows path of the form \\server\share\path\file but that latter form won't work on non-Windows systems.
    So the short answer is that you probably have to create two sets of links, one for the Windows users and one for the Macs. There's no simple, universal, cross-platform symlink standard that will do what you want (at least that I'm aware of).

  • Invoking a java program from a shell script!

    Can this be done?
    Ive written a simple compiler for the language buru which just reads/parses and then executes a file for this java like language. But what Im wondering is if I can write a shell script something like this
    #!/bin/bash
    java Interpreter one.buru
    this isn't working so its not correct but if someone knows how to do so there are duke dollars going for it Cheers :)

    The most likely reason is that java is not finding your class.
    That is probably because when you execute the script the "working directory" is not in a location that works with your class path.
    You should be able to find the working directory and class path with the following commands (or some variation of them) added to the beginning of your script.
    cd
    echo $CLASSPATH

  • Starting Java Program with a bash Shell script

    Hi !
    I know this is a Linux query but I am putting it on this site to get different answers.
    I want to start my Java program with a shell script. Can anybody give me a proper script to start my Java program?
    I am using RH Linux 7.3 and JDK 1.4.
    Can I start the Java program without starting the terminal? Just like the Sun One Studio4 'runide.sh' script.
    Please help.
    Bye Niteen

    assuming you have your PATH and CLASSPATH variables set correctly, your script should look like this:
    #!/bin/bash
    cd <project_dir>
    java <class> &
    example:
    #!/bin/bash
    cd ~/projects
    java project1.main_package.MainClass &
    of course you could add some more elaborated stuff like compiling files before running the program, etc.
    if you dont like terminals, try running "nautilus" (it's like Windows Explorer). i never use nautilus (especially for running scripts), so i cant guarantee it will work, although i dont see why it shouldnt...

Maybe you are looking for