|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
Double Click Bash From Desktop
I am relatively new to Mac OS. I am trying to do something which I perceive should be simple. I have created a 'bash' script and put it on the Desktop. All I want to do is double click it and have it run. But its tell me either:
1. There is no program associated with this file, or 2. Its opening a text editor This program is just going to be downloaded from a website onto a users machine and should be ran. I don't want the end user to have to do any configuration. Is this possible somehow? |
|
#2
|
||||
|
||||
|
end it's filename in `.command`
![]()
__________________
~James [Not currently seeking freelance work] Like philosophy or interested in spirituality? Philosophorum. Game Dev Experts Forums Foresight Linux - Because your desktop should be cool! Linux FAQ FedoraFAQ UbuntuGuide |
|
#3
|
|||
|
|||
|
Someone else told me to do that. So now I can click it. But it doesn't execute. When I run it from the command line, it runs. All I'm doing in the file is this:
echo "TEST" > /Users/me/Desktop/test.txt When I double click the icon blinks and flashes for a second, like it ran, but nothing happens. From command line it works perfectly. I must be overlooking something. Permissions are 777 for testing purposes. |
|
#4
|
||||
|
||||
|
You need to put a shebang line on the top of it
Code:
#!/usr/bin/bash That means `when this is run just by scriptname, make bash run it` |
|
#5
|
|||
|
|||
|
Thanks, but yes, I have that as well. This is my file:
**************** #!/bin/bash echo "TEST" > /Users/me/Desktop/test.txt **************** Very simple, but very frustrating. |
|
#6
|
||||
|
||||
|
Alright, what does it say when you do this in bash?
`open /path/to/file.sh.command` |
|
#7
|
|||
|
|||
|
The bash.sh.command file is on my desktop. So from my terminal I just typed:
# open /Users/me/Desktop/bash.sh.command Didn't do anything. Just came back with a prompt on the next line. |
|
#8
|
||||
|
||||
|
Theoretically it just ran your script then. *shrug*
|
|
#9
|
||||
|
||||
|
well i'm having the same problem too, and since you want to know i have decided to find out, lets see what does it
the shebang does not work the .command thing does not work the execute bit does not work deleting the .DS_Store and logging out/in does not work right-click->Get Info->Open With->other application->/Applications/Utilities/Terminal.app - the above will make it run, but it does this by opening the terminal and running it there now looking at Terminals help, i see this Quote:
so then this apple script will run the shell script on my desktop without opening the terminal, you will just see the apple-script icon jump on the dock for a minute (or longer if it takes a while) Code:
do shell script- "/Users/edman007/Desktop/Synergy.sh" i think apple script will let you save the script in an application bundle so you can keep the script where ever you move the script and not worry about deleting the shell script
__________________
Feed ME |
|
#10
|
||||
|
||||
|
|
|
#11
|
||||
|
||||
|
Quote:
that does work, but only if its a new file, if it was mapped to an application before you try this it will not work (for example if you save it with a text editor it will usually make it open with that program), OSX will keep the application assigned to open any file in resource forks somewhere (i though .DS_Store file was it, but i guess not), the file is tracked by the filesystem id, so moving it, modifying it, and renaming it will not change what it opens with, the extension has no affect if it has already found an application to open it, same with permissions the "open with" thing i listed will change what the finder uses (but not its icon), then it will execute with the terminal, and the apple script thing i showed will make it execute as part of your apple script, and it won't use the terminal |
|
#12
|
|||
|
|||
|
Thanks for all the responses. So after I 'gave up' and decided to work on something else for a while, it started to work. Basically I just closed the terminal window that this appeared to be associated with. I opened up another one and then it would work with running from the command-line and also with double clicking.
Argh....5 hours for this? Thanks all for your help. |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > Mac Help > Double Click Bash From Desktop |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|