Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SCRIPT EDITOR

Status
Not open for further replies.

klh456

MIS
Oct 11, 2002
164
US
This may be the easiest question on this forum. Can someone tell me if I can edit ksh script files using something other than vi? If I move them to my Windows box I can open them with Notepad and read the contents. If I make a change and save it when I move the file back to the UNIX box, it can no longer be opened in vi. I am doing the moves through FileZilla.

I am very new to UNIX, but have a long Windows background. I understand what the scripts are doing. I need to create some new ones modeled on ones that are already working well. Just need to change certain parameters for the new scripts. I dread trying to do this in vi.

Now that you have stopped laughing, perhaps someone can tell me how to do this. :-D.

Thanks

K
 
You may use any editor, provided it don't add a CR (hex 0D) before the standard unix end of line (LF: hex 0A).
Have you tried wordpad instead of notepad ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
No, I didn't try Wordpad because I thought I would have a better chance of it working with Notepad. Perhaps the problem isn't the editor. When I try to reopen the file in vi (after making a slight change and copying it back to the UNIX box) I get this error:

The file access permissions do not allow the specified action.

I am only trying to open the file, which I can do to the original file. It opens vi because I have to :q! to get back to a command prompt.

Am I missing something?
 
man chmod

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks PH

I actually realized this once I thought it through over the weekend. I checked the ACL and the file I copied was owned by the root:system and the rights were all wrong. I changed it to match the other files and now I can open it without a problem. I'm set now to tackle these scripts.

That does bring up another question though. Is there a better way to move these files and work on them so the owner and all rights remain the same?

Thanks again.
 
Another way, if you insist on using a Windows based file editor, is to export the file system as a Samba share so that it might be seen from your Windows machine.

If you are going to be spending any time working on Unix I strongly urge you to learn at least the basics of 'vi'. Ok, we all struggled at first, it's about as user unfriendly as it can get but - once you get the basics sorted - it's one of the most powerful editors you can use. Furthermore many of the Unix utilities assume basic knowlege of vi - crontab -e, for example opens the cron tables for editing - and the editor it uses is vi.

One further point - beware editing system configuration files outside of the Unix environment. Windows uses CR/LF as the line delimiter whereas Unix uses LF. The file conversion should be done as the file is copied between the different environments but if it's not you get the Ctrl-M problem (see numerous posts in this forum) and the scripts may not work. If the script is trivial the problem is trivial but if it's an important system file...

Ceci n'est pas une signature
Columb Healy
 
You should try out TextPad on WinDoze.
You can edit Unix/DOS/Binary and other types of files.
[3eyes]


----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
I export the unix DISPLAY to my pc. (For Windows you can use something like Cygwin and install the xserver)
Then I can edit using gvim etc. without worrying about permissions, dos characters etc.



"If you always do what you've always done, you will always be where you've always been."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top