OS X: How to run script from Finder as icon


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting OS X: How to run script from Finder as icon
# 1  
Old 08-28-2011
Question OS X: How to run script from Finder as icon

Hello,

Running Mac OS X 10.6.8. I have this very simple script within a directory where I play (modify, compile, run) with some java code. When I'm finished I run this script to erase all the .java and .class files and copy clean versions from the subdirectory Backup. I can run this script by typing ./scriptName.sh and it works fine.

I would like to just have an icon in the same directory where I am playing so I don't have to go to terminal to run the script. (No need to use the echo statements.) I tried AppleScript and Automator, but not being experienced, well, I don't know what else to do. I tried stating the full path for the commands, but still no success. The .sh has the right chmod executable settings, etc.

I can do this easily in Windows with a batch file and just clicking it's icon. Any kind suggestions? Thank you.
Code:
#! /bin/bash
# Shell script to replace working files in this current directory
# with the old backed up files in the subdirectory Backup
echo "Removing *.java from this current directory."
rm *.java
echo "Removing *.class from this current directory."
rm *.class
echo "Copying backup files from Backup directory to this current directory."
cp Backup/*.* .
echo "Finished script."


Last edited by Scott; 08-28-2011 at 12:24 PM.. Reason: Added code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script run in a case statement call to run a php file, also Perl

Linux System having all Perl, Python, PHP (and Ruby) installed From a Shell script, can call a Perl, Python, PHP (or Ruby ?) file eg eg a Shell script run in a case statement call to run a php file, also Perl or/and Python file??? Like #!/usr/bin/bash .... .... case $INPUT_STRING... (1 Reply)
Discussion started by: hoyanet
1 Replies

2. Windows & DOS: Issues & Discussions

Run Bash from Windows icon?

Is it possible to run a bash using a by creating an icon or shortcut in windows 7? Everything seems to be for unix or linux and unfortunately my institution is windows. For example, run bash ~/newbatch.sh by clicking on an icon on a users desktop. Cygwin will be installed as well. Thank you... (8 Replies)
Discussion started by: cmccabe
8 Replies

3. OS X (Apple)

Shell Script to change desktop short cut Icon

I have installed my flash application using shell script. I have created short cut to desktop. Now i want to change the default short cut Icon. Please tell me script to change the short cut icon. ---------- Post updated at 12:54 AM ---------- Previous update was at 12:33 AM ---------- Working... (0 Replies)
Discussion started by: rohaneee
0 Replies

4. Shell Programming and Scripting

how to run an already made script run against a list of ip addresses solaris 8 question

how to run an already developed script run against a list of ip addresses solaris 8 question. the script goes away and check traffic information, for example check_GE-VLANStats-P3 1.1.1.1 and returns the results ok. how do I run this against an ip list? i.e a list of 30 ip addresses (26 Replies)
Discussion started by: llcooljatt
26 Replies

5. OS X (Apple)

Change app Icon when script is completed.

In a recent topic, I asked how I could run a shell code without having to deal with terminal opening. What I'm trying to accomplish now is to make my app change it's icon when the code is complete. (With complete I mean when the process is done.) Thanks in advance. :) (10 Replies)
Discussion started by: ShadowofLight
10 Replies

6. AIX

My script didn't run every run every minute at cronjob

In my cronjob, I would like to schedule my script.sh to run every minutes. I crontab -e and have in line below but it didn't seems to run at all. * * * * * script.sh When I run it manually, I can run it. Is that anything wrong with the above line? If I change it to something like below,... (4 Replies)
Discussion started by: ngaisteve1
4 Replies
Login or Register to Ask a Question