Marc van Dijk
05-24-2005, 11:40 AM
Oh yes: I use Tiger, have X11 installed and work in Bash.
I made a alias to nedit in .bash_profile as nedit=’open /Applications/Werk/Editors/nedit?br />
Greetings
Marc
hayne
05-24-2005, 12:38 PM
I made a alias to nedit in .bash_profile as nedit=’open /Applications/Werk/Editors/nedit?br />
That's the problem.
The above alias will open the application 'nedit'.
If you want to open a particular document (file) with 'nedit' then you should use:
'open -a nedit name_of_file'
You seem to have been assuming that using the 'open' command would pass the name of the file as a command-line argument to the application. That is not the case. Applications in OS X do not normally take command-line arguments.
What was happening when you used your alias with the name of a file appended was that the 'open' command got two arguments: '/Applications/Werk/Editors/nedit' and the name of the file. And it opened them both.
As an alternative to using 'open', you could just use the full path to the executable as you might be used to in Linux. But note that OS X applications are usually bundles and what you think of as the application is actually a folder. The actual executable is inside a Contents/MacOS sub-folder.
Marc van Dijk
05-24-2005, 02:26 PM
Thanks that solved the problem. I Changed the alias to nedit=?Applications/werk/Editors/nedit?br />
If I type “nedit filename.*?the file will be opened in nedit.
In this case it seems the open –a option is not necessary.
When do I need to use open –a?
Thanks
Marc
hayne
05-24-2005, 05:15 PM
The 'open' command is a convenience that allows you to open an application without knowing its path and is independent of the PATH mechanism in the shell. It also allows you to open a file with the application that is associated with that file without necessarily knowing what that application is or where it is.
Read 'man open'