Running Shell scripts from the desktop

Hi,
I'm from the UNIX world rather than the mac one so have written a number of shell scripts. Lets call them foo.sh and bar.bash for the sake of argument.
These are sitting in a folder on my desktop
I can happily open a terminal session and run the scripts - and they work as I expect them to.
If I open a Finder window and double click on the icons for the scripts what happens is that it opens TextEdit.
Theres two things I'd like to change
A. I'd like to change the behaviour so that the scripts run when I double clike them rather than opening an editor (possibly in a terminal window )
B. I'd like to be able to change the editor from TextEdit to one I'm more used to...(I've installed Vim/Gvim which I quite like).
A. - Haven't managed to get anywhere trying to solve this....
B. - So far my attempts have got as far as...
1...
right-click -> open with -> Other -> select vim.app
tick Always open as
click open
The file then opens in a vim window.
however if I now close the vim application and double clike the file icon then the file opens in TextEdit again
2...
Right Click -> Get Info -> Open with VIM -> add -> Change all
message appears
'Are you sure you want to change all your Vimm.app documents to open with the application "vim.app"
This change will apply to all Vim.app documents with extension ".sh" '
click continue
In the Info pane the 'Open with' selection widget immediately changes to say 'Open with: TextEdit.app'
So I'm a bit stumped, can you help!
Regards
Mark
Mac Mini   Mac OS X (10.4.3)  

Thanks to both people who answered.
You both gave me useful workarounds to my problem.
Renaming the scripts to be 'foo.command' was very hepful and useful to know. I tried this and it does indeed work. I may use this in the future.
I also had a play around with applescript and the automator to achieve similar results.
I agree that double clicking to run the file and also edit it is mutually exlcusive - I'm sort of trying to work out how I could make it do 'either/or' as I choose. In the Windows world i'd have the option of setting 'open' to run the script (assuming I'd got cygwin installed and had assiciated it) OR 'Edit with vim' if I wanted to edit the file (assuming vim was installed!).
Unresolved issue is that I'm still unable to get VIM to be associated with a .sh file.
The way I would envisage it working in Mac world would be to be able to right click on foo.sh -> Open with... and have a list to select from immediately there like..
Text Edit
Vim
Terminal (default)
and be able to somehow add and remove apps from the list and change which is the default.
My issue is that I don't seem to know how to get other apps than TextEdit to appear in the list - I suspect I need a better understanding of how these file/application associations work and are configured.
Regards
Mark

Similar Messages

  • How I run a shell script from the scheduler on 10.2.0.2.0 ?

    Hello Oracle People,
    I'd like to run a shell script from the Scheduler in my 10g database.
    Right now it is a simple shell script.
    Eventually it will wrap RMAN commands to back up my DB.
    I wrote a simple pl/sql script to create a job:
    -- cr_job10.sql
    BEGIN
    DBMS_SCHEDULER.CREATE_JOB (
    job_name => 'my_backup_job',
    job_type => 'EXECUTABLE',
    job_action => '/h/oracle/scripts/tst.sh',
    start_date => '06-SEP-07 5.33.00PM US/Pacific',
    repeat_interval => 'FREQ=DAILY',
    end_date => '08-SEP-07 4.00.00PM US/Pacific',
    enabled => TRUE,
    comments => 'My Backup Job');
    END;
    I see no errors when I run the above procedure.
    I checked DBA_SCHEDULER_JOBS and the job is in there.
    The scheduler, though, errors out with an error which I see in a trace file:
    /h/oracle/admin/orcl/bdump/orcl_j000_22396.trc
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    ORACLE_HOME = /h/oracle/product/10r2
    System name: SunOS
    Node name: sol
    Release: 5.10
    Version: Generic_118855-14
    Machine: i86pc
    Instance name: orcl
    Redo thread mounted by this instance: 1
    Oracle process number: 15
    Unix process pid: 22396, image: oracle@sol (J000)
    *** ACTION NAME:(MY_BACKUP_JOB) 2007-09-06 17:33:00.175
    *** MODULE NAME:(DBMS_SCHEDULER) 2007-09-06 17:33:00.175
    *** SERVICE NAME:(SYS$USERS) 2007-09-06 17:33:00.175
    *** CLIENT ID:() 2007-09-06 17:33:00.175
    *** SESSION ID:(140.13520) 2007-09-06 17:33:00.175
    *** 2007-09-06 17:33:00.175
    ORA-12012: error on auto execute of job 53267
    ORA-27369: job of type EXECUTABLE failed with exit code: 274662
    I googled on this:
    ORA-27369: job of type EXECUTABLE failed with exit code: 274662
    Google returned only 1 hit.
    There, I see some evidence that I need to configure something inside
    of Oracle to run shell scripts from the scheduler, but possibly just
    for machines running windows. I'm running Solaris.
    Do any of you know what I need to configure inside of Oracle to
    run shell scripts from the scheduler?
    -Owen

    Hello people,
    I should have added this bit of information:
    "The script runs fine from oracle's crontab."
    "The script runs fine from a shell owned by oracle."
    I'm getting responses telling me to check my env variables and permissions
    which would be helpful to a UNIX novice.
    I have a feeling that no one is using the scheduler to run RMAN scripts.
    Tim Hall suggested I take a close look at these files:
    $ORACLE_HOME/rdbms/admin/externaljob.ora
    $ORACLE_HOME/bin/extJob
    Currently I'm setup like this:
    bash sol root /h/oracle/product/10r2/bin 31 #
    bash sol root /h/oracle/product/10r2/bin 31 # ll $ORACLE_HOME/rdbms/admin/externaljob.ora
    -rw-r--r-- 1 root dba 52 Sep 7 15:29 /h/oracle/product/10r2/rdbms/admin/externaljob.ora
    bash sol root /h/oracle/product/10r2/bin 32 #
    bash sol root /h/oracle/product/10r2/bin 32 # cat $ORACLE_HOME/rdbms/admin/externaljob.ora
    # externaljob.ora
    run_user = rman
    run_group = rman
    bash sol root /h/oracle/product/10r2/bin 33 #
    bash sol root /h/oracle/product/10r2/bin 33 #
    bash sol root /h/oracle/product/10r2/bin 33 #
    bash sol root /h/oracle/product/10r2/bin 33 # ll $ORACLE_HOME/bin/ext*
    -rwsr-x--- 1 rman dba 30388 Sep 21 2006 /h/oracle/product/10r2/bin/extjob*
    -rwsr-x--- 1 rman dba 30392 Sep 21 2006 /h/oracle/product/10r2/bin/extjobo*
    -rwsr-x--- 1 rman dba 34468 Sep 21 2006 /h/oracle/product/10r2/bin/extproc*
    -rwxr-xr-x 1 oracle dba 300 Sep 21 2006 /h/oracle/product/10r2/bin/extusrupgrade*
    bash sol root /h/oracle/product/10r2/bin 34 #
    bash sol root /h/oracle/product/10r2/bin 34 #
    bash sol root /h/oracle/product/10r2/bin 34 #
    On my system, the user 'nobody' has no shell so I cannot use nobody.
    I created a user named rman:
    bash sol root /h/oracle/product/10r2/bin 34 #
    bash sol root /h/oracle/product/10r2/bin 34 #
    bash sol root /h/oracle/product/10r2/bin 34 # su - rman
    Sun Microsystems Inc. SunOS 5.10 Generic January 2005
    $
    $ id
    uid=220(rman) gid=220(rman)
    $
    $
    $ date
    Fri Sep 7 16:30:03 PDT 2007
    $
    $
    Jared points out that rman needs access to extproc:
    $ ls -la /h/oracle/product/10r2/bin/extproc
    -rwsr-x--- 1 rman dba 34468 Sep 21 2006 /h/oracle/product/10r2/bin/extproc
    $
    $
    Here is a demo of rman running his script:
    bash sol root /h/oracle/product/10r2/bin 35 # su - rman
    Sun Microsystems Inc. SunOS 5.10 Generic January 2005
    $
    $
    $ ls
    scripts
    $
    $
    $ scripts/tst.sh
    $
    $
    $ cat scripts/tst.sh
    #! /bin/sh
    /usr/bin/date > /tmp/tst.sh.out.txt 2>&1 &
    exit 0
    $
    $
    $ cat /tmp/tst.sh.out.txt
    Fri Sep 7 16:31:23 PDT 2007
    $
    $ rm /tmp/tst.sh.out.txt
    $
    I am focused on this error:
    ORA-27369: job of type EXECUTABLE failed with exit code: 274662
    And I am focused on this exit code: 274662
    What does 274662 mean?
    If the Scheduler gives me an error like "274662" rather than some English,
    it's obvious to me the Scheduler is a POS and I should not use it.
    And of course,
    If I cannot run RMAN from Oracle Scheduler, I'll use cron.
    -Owen

  • How to run a shell script from the GUI?

    This is probably a dumb question...
    How do I run a shell script from the GUI? I've been told to double click it but when I do, it opens as a text file.

    The behavior you describe is that used by the KDE and GNOME desktops of Linux.
    Under OS X, if you make a script then mark it as executable, double-clicking on it in the Finder will not execute it. Actually, it uses a rather complex algorithm ([summarized here|http://arstechnica.com/reviews/2q00/macos-qna/macos-x-qa-2.html]) to determine what to do with it. This is implemented in Mac OS X' LaunchServices framework (incidentally, the associations are cached in /Library/Caches/com.apple.LaunchServices*.csstore and ~/Library/Caches/com.apple/LaunchServices*.csstore). You can read the details in the developer docs about LaunchServices.
    Anyway, in short, the suffix '.command' is a built-in type in the LaunchServices network that identifies a shell script. If you run
    /System/Library/Frameworks/ApplicationServices.framework/Frameworks/LaunchServic es.framework/Support/lsregister -dump
    ... it will tell you as much.

  • Running shell scripts from within oracle. A big task is forgotten

    Dear List,
    I have some shell shell scripts which do some tasks on the linux OS level.
    I am calling the Korn scripts using a java class, which in turn is being called from a PLSQL function.
    All but one of the 10 script works fine. This is the script which does the most work, and takes on average 40 minutes usually.
    Why does Oracle forget the running of the shell script? I wait in my PLSQL function for the return code, but it never comes. The scripts I have not written myself !
    I look forward to your reply on this matter.
    regards
    Ben

    Hi
    If you are using the Oracle database 10g, the new dbms_scheduler package allows you to run shell scripts. The dbms_scheduler.create_job procedure have one parameter called the job_action in which you specify the full path of the shell script.
    I hope this will help

  • Running shell script from terminal

    If I run this shell script from the terminal it plays the sound though my external speakers;
    volume="/Volumes/8GIGSTICK"
    if mount|grep $volume; then
    afplay -d /System/Library/Sounds/insert.wav
    rsync -a /volumes/8GIGSTICK/documents /Users/mcp/Documents/Microsoft\ User\ Data/
    else
    say not mounted
    fi
    If I have launchd run it when the volumes is mounted it only plays the sound through the internal computer speaker.
    Anyone know why and how I can fix it?

    It's probably because your launchd job isn't running in the Aqua context and therefore doesn't pick up your sound-output preferences. One way to overcome this would be to load the job as follows:
    launchctl load -S Aqua -D user job_label
    That's assuming you have a launchd property list at ~/Library/LaunchAgents/job_label.plist. To make the effect persist across login sessions, you would create a file ~/.launchd.conf with the contents
    load -S Aqua -D user job_label

  • Running shell scripts from GUI

    I'm trying to run a simple shell script (bash or sh) from the GUI (just double click it).
    I've managed to run it by double clicking, BUT, it runs from my home directory (even if i add --noprofile or remove #!/bin/bash line completely).
    How can I keep the current directory, or at least get it as a variable?
    Thanks,

    Hi
    If you are using the Oracle database 10g, the new dbms_scheduler package allows you to run shell scripts. The dbms_scheduler.create_job procedure have one parameter called the job_action in which you specify the full path of the shell script.
    I hope this will help

  • I want to run a report from the desktop

    I want to run a report from the desktop using RWRUN60
    What all has to be installed on it to make it work
    I have 10g client on mine and it works but I can't install that on all the clients
    Is there a little install package for this?
    Thanks

    RWRUN60 is a part of "Oracle From6i Developer Suit". If you want to run report on desktop client than you have to install "Form6i Developer Suit" on every client where report is needed.
    I was facing the same issue and it was a difficult job to install "Form6i Developer Suit" on each client. So, I done the followings.
    1. Configured Oracle Application Express
    2. Created Required Application in Oracle Application Express
    3. Installed "Oracle 10g Developer Suit" and configured "PDF Report Services"
    4. Now, each user is running the application through URL and I have saved my time of installations.

  • Running Shell script from command line

    Hi,
    I am getting a Exception in thread "main" java.lang.NoClassDefFoundError: TestRuntime/java error when I run the following code on my linnux box...can anyone please help
    import java.io.*;
    public class TestRuntime {
            public static void main(String args[]) {
                    Runtime runtime = Runtime.getRuntime(); //get runtime information
            try {
                            Process Child = runtime.exec("/usr/bin/ksh"); // execute command
                            BufferedWriter outCommand = new BufferedWriter(new OutputStreamWriter(Child.getOutputStream()));
                            outCommand.write("/home/mypath/tesh.csh");
                            outCommand.flush();
                            try {
                                    Child.waitFor(); // wait for command to complete
                            } catch (InterruptedException e) { // handle waitFor failure
                                    System.out.println("ERROR: waitFor failure");
                                    System.exit(10); // exit application with exit code 10
                    } catch (IOException e) { // handle exec failure
                            System.out.println("ERROR: exec failure" + e);
                            System.exit(11); // exit application with exit code 11
    }

    If I'm reading your code correctly, you're starting a Korn shell session, then executing your C shell script as if you were at at the session window's prompt. If that is correct, you haven't caused your standard out (stdout) to hit ENTER yet. I'm not an expert, but I hope this works for you.
    Your code:
    Process Child = runtime.exec("/usr/bin/ksh"); // execute command
                            BufferedWriter outCommand = new BufferedWriter(new OutputStreamWriter(Child.getOutputStream()));
                            outCommand.write("/home/mypath/tesh.csh");
                            outCommand.flush();I think you need to enter one extra line before the flush():
    Process Child = runtime.exec("/usr/bin/ksh"); // execute command
                            BufferedWriter outCommand = new BufferedWriter(new OutputStreamWriter(Child.getOutputStream()));
                            outCommand.write("/home/mypath/tesh.csh");
                            outCommand.newLine();  // hit ENTER
                            outCommand.flush();P.S. If you're running this script and your Java program from the same UNIX machine, you could just execute the shell script inside the runtime.exec() call.

  • Run shell script from plsql

    You can use utl_tcp to do http posting, send email, and ftp files. Has anyone ever executed a unix shell script from plsql on a remote unix box?

    I am actually asking about running a script file on a remote machine, not on the host. A java procedure or c file extproc call could be used to call a host script file.
    A key limitation of this java procedure method is shown in the ask tom reference:
    if you can do it from sever A on the command line (outside of oracle), we can do
    it inside the database.
    Solve that problem and we'll go from there. Oracle cannot bypass the OS and do
    magical things beyond what you've set up at the OS level.
    since utl.tcp opens a tcp connection, can you open a telnet session using utl_tcp and low level command formatting? I didnt have much trouble creating a plsql based ftp client, has anyone seen a plsql based telnet client?

  • Running Shell Script from

    Dear Friends!
             I have one requirement, I have to trigger Unix Shell script from ABAP program.   but only twist in the story is my SAP box is not in Unix system so I cant use external command execute function module.  Is any one come accross to such scenario ? Please advice on this that How we can do this task.
    I have one idea like
    I can make shell script from ABAP put into FTP directory of Unix using webservice and schedule the background job or something in UNIX so after some time it get executed but not sure on this. if we can achieve this in real time it will be really cool compare to background job or something.
    Please give me your expert advices. Any help from you will be greatly appreciated.
    Thanking you and Regards
    Naeem

    I use PI for this.

  • Run Shell script from oracle plsql

    OS--> Linux
    Version--Oracle 10g
    I want to run a shell script from oracle PL/sql. I know dbms_scheduler can be used to create job , enable job and run it .
    But I have a requirement where I need to know if my script ran successfully or not. Something like a return code back to oracle.
    So that I can run appropriate code depending on return code of executed Script.
    Kindly help !!

    Online documentation was invented for a reason.
    And this reason was not would look it, as a volunteer, on your behalf, and post it in this forum.
    All procedures are documented. There are examples for most facitlities on Asktom, and there is Morgan's Library at [http://www.psoug.org]
    Sybrand Bakker
    Senior Oracle DBA

  • Can I run a shell script from the services menu?, part II

    Remember this?
    It is now possible.

    Doesn't look like there is a direct way to do it.
    The services are all Bundles, which is easy
    enough to fake -- just copy one from /Library/Services
    to ~/Services and modify the plist. Put your shell
    script in Contents/MacOS/ and identify it in the
    plist under CFBundleExecutable and hope for the
    best
    Where it gets sticky is CFBundlePackageType (APPL
    for Application, FMWK for FrameWork, BNDL for
    'loadable bundle', whatever that is] and NSServices.
    CFBundlePackageType should pose no problem if Services
    use the OS loader and handles file magic [and '#!' of
    course].
    NSServices specifies a named port that the app
    listens on, the data type it receives, and so forth.
    This looks a bit harder to fake. I'd bet Applescript
    has the functionality, and there may be some
    command-line hooks to backend that, or it may be
    possible to netcat your way through it.
    But it doesn't look trivial
    Property List Key Reference
    Anyways, tried it with a quick script that echoes to a
    file, and haven't figured out how to refresh the
    Services menu to get it to appear. Probably have
    to NetInfo it or something ridiculous; doesn't appear
    to watch the FS.
    [ Edited by Apple Discussions Moderator; href URL ]

  • Can I run a shell script from the Services menu?

    This would be kind of cool.
    Is there a simple way to do this?

    Doesn't look like there is a direct way to do it.
    The services are all Bundles, which is easy
    enough to fake -- just copy one from /Library/Services
    to ~/Services and modify the plist. Put your shell
    script in Contents/MacOS/ and identify it in the
    plist under CFBundleExecutable and hope for the
    best
    Where it gets sticky is CFBundlePackageType (APPL
    for Application, FMWK for FrameWork, BNDL for
    'loadable bundle', whatever that is] and NSServices.
    CFBundlePackageType should pose no problem if Services
    use the OS loader and handles file magic [and '#!' of
    course].
    NSServices specifies a named port that the app
    listens on, the data type it receives, and so forth.
    This looks a bit harder to fake. I'd bet Applescript
    has the functionality, and there may be some
    command-line hooks to backend that, or it may be
    possible to netcat your way through it.
    But it doesn't look trivial
    Property List Key Reference
    Anyways, tried it with a quick script that echoes to a
    file, and haven't figured out how to refresh the
    Services menu to get it to appear. Probably have
    to NetInfo it or something ridiculous; doesn't appear
    to watch the FS.
    [ Edited by Apple Discussions Moderator; href URL ]

  • Running Shell Script from another server

    Hi,
    I have a shell job in QA server. Is there any way to run this shell job from another linux server.
    Thanks,

    you can execute it remote with ssh
    ssh serverb /path/to/script.sh
    this executes the script on the remote server (serverb) not local!

  • Can "Planners" run calc script from the Planning web?

    This is probably a really naive question.
    However, can planners run a simple calc script(created in Essbase/AAS) from Workspace/Planning Web? If so what access would they be need to setup in Shared Service?
    Or do we have to convert the calc script into a Business Rule and then grant access to the users?

    John,
    Here are the roles that i assigned my user and he can view/launch the calc scripts from Planning Web without actually being an admin( i think)
    Analytic Servers : server access
    Business Rules: Administrator
    Planning App : Interactive User
    APS : Provisioning Manager
    I would also like to conver the calc script to a BR as suggested, but not sure why i see no users available in the Business Rules-> administration tab.
    As indicated above, the use has been provisioned as a BR admin!
    Also, i tried refreshing the app with filters, refreshing the user list from BR->admin(right mouse), de-provision and re-provision the user! Any ideas??

Maybe you are looking for

  • Payment term Block

    Hi, can any one let me know in detail, the use of the fields <b>Block Key</b> & <b>Payment Method</b> in payment term configuration ? thank you. Hi experts, any answer ? Message was edited by:         deb hari Message was edited by:         deb hari

  • Macbook Air 2014 is very slow after waking from sleep

    Constantly, when using my Macbook Air 2014 without power cord (which I am required to do at College), when my laptop goes to sleep, and I then immediately click to wake it up, it takes at least 20 seconds before the log on screen will come up.  The m

  • Passing/refering parameters to another report

    Hi, I am developing a report which displays multiple rows. Say, this is a summary. When clicked on any row I would like to pass the values of columns for that row to another report and display relevent details. How will I pass these values to next re

  • Firewire Question

    I have been using the front Firewire 400 port to drive a small Lacie drive (I use for my MacBook Pro. Somehow the port stop working. I can plug in a drive and I can hear is running but the OS is not "seeing" it. All other ports work. Any ideas why th

  • Overclocking and Durability

    Hello, my name is Emilio and i live in Argentina. I recently purchased the machine described in the sig. The thing is, with the economy here this machine has to last forever. In my company's system i put in all the old machines when i buy a new one,