Networking | Hardware | Software | Multimedia | System | Unix&Linux | MBA

Home>>Unix&Linux>>Problem opening text files from command line using nedit

Problem opening text files from command line using nedit

Marc van Dijk
05-24-2005, 01:43 AM
Hello everybody,

I have worked with Linux for quit some time now and recently made a switch to mac.
I immediately installed my favored editor nedit and plotting utility grace.

By themselves they both work excellent but I noticed that I cannot open (all)files with nedit using the command line.
For instance: if I make a small text document using pico and safe as test.txt and subsequently try to open this file using “nedit test.txt?it will open nedit but with a blank text field and open another window with the default text editor of Mac (Texteditor.app) that displays the file. If I do not add a extension to the “test?file the same thing happens. If I ad an arbitery extension such as *.tbl the following message appears:

2005-05-24 08:33:47.521 open[218] LSOpenFromURLSpec() returned -10814 for application (null) urls file://localhost/Applications/Werk/Editors/nedit, file://local
host/Users/marcvandijk/test.tbl.

I can open all files from within nedit but no files from the command line. Nedit is perfectly capable of opening any text file no matter what extension. Can anyone help me solve this problem?

The same problem is true for the plotting utility “grace?(no opening of grace *.agt files from command line)

Thanks,

Marc

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'


 

TOP

Windows Server Outsell
Unix Signals And C++ E

For more info

Unix Signals And C++ E
Windows Server Outsell
ssh setup for password
Bash script does not w
esc code 
ARD send unix command 
question about binarie
Scanning mail 
Issuing multiple comma
How do I install Linux

News Archive

/etc/hosts? 
Manually Start a Start
mounting missed hard d
Using Netinfo in Singl
darwin/bsd login probl
system_profiler and fi
Send mail from script 
mounting a drive 
OS X disk first aid ha
system.log shows steal

Related stories:

simple use of grep & cp commands question
ditto or just drag and drop
Output system.log in terminal
cron running tasks twice simultaneously!
How to figure out devicename for my CDROM
How do you mount an SMB share in terminal?
Changing my shell to Bash

Copyright@2004-2005 www.zzcoke.com All Right Reserved

advanced web statistics