# shell script editor



## da1 (Aug 21, 2011)

Hi guys,

I'm in the process of writing a shell script that will exceed 500 lines. Since I'm a kiddie at this, I would like to use some editor to keep track of my syntax and to make my life easier. I did a quick check on google but to be honest, I have no idea what to search for and I was wondering if you guys use something like this when writing long scripts.

Some examples would suffice.

Thx


----------



## Beastie (Aug 21, 2011)

editors/vim supports syntax highlighting for sh, ksh, (t)csh and zsh.


----------



## UNIXgod (Aug 21, 2011)

Here is a reference of POSIX shell commands

http://rubyprogrammer.net/~stu/posix/


----------



## expl (Aug 21, 2011)

I use devel/geany for most programming, has syntax highlighting for most languages also has hinting engine and some useful plug-ins. It is also ultra light, simple and fast compared to the popular IDEs.


----------



## graudeejs (Aug 21, 2011)

Beastie said:
			
		

> editors/vim supports syntax highlighting for sh, ksh, (t)csh and zsh.



and others...

Note that by default vim will be pretty equivalent to /bin/vi
You'll need to customize.


----------



## da1 (Aug 22, 2011)

Thx expl. I tried geany and it looks nice. ViM is also ok if I want to work while on the road or something but since I have XFCE4, geany is for my purpose, better.


SOLVED.


----------



## kpedersen (Aug 22, 2011)

geany will come and go but vi and vim are here to stay (much longer than our lifespans).

So putting in the effort to get used to vim would be generally more rewarding...


----------



## fonz (Aug 22, 2011)

Pretty much any halfway decent editor can (be made to) work with pretty much any conceivable scripting/programming/markup language. From the looks of it, most of the people here on this forum who actually do any programming seem to prefer editors/vim but if you have control of your own setup, feel free to try a couple and use whatever floats your boat (or your variables, as the case may be). devel/geany has already come up, another popular editor (although not with me) is editors/emacs and I'm sure there are others.

Having said that, kpedersen makes a good point: it's almost always a good idea to learn at least the basics of vi(1) (not even editors/vim) because it's always there and sometimes might even be the *only* thing there.

Happy coding,

Fonz


----------



## da1 (Aug 22, 2011)

I'm quite conformable with vi and I love it but for this case (a long scripts) I was curious about trying something new.


----------



## vwe@ (Aug 24, 2011)

da1 said:
			
		

> I'm quite conformable with vi and I love it but for this case (a long scripts) I was curious about trying something new.



If you're really comfortable with using vi and want to try something "better", try vim, be sure to enable color support and fully customize it to your needs and likings (~/.vimrc). If you feel unsatisfied for working on a character interface (which is nonetheless some kind of geeky), give gvim a try.

I really like gvim as it gives me the comfort of vi and has a nice user interface (but most times I'm still running vim in an xterm). BTW, gvim uses the same rc file as vim does.


----------



## jrm@ (Aug 24, 2011)

da1 said:
			
		

> I'm quite conformable with vi and I love it but for this case (a long scripts) I was curious about trying something new.



You might like editors/emacs.  Here are a few reasons:

In daemon mode, emacsclient starts up in a snap and you can edit the same files in the terminal client or the graphical client.

It's very light, even compared to (g)vim.  After opening both editors, here is the output from top:


```
3742 jrm            1  46    0 39592K 27164K select   0:00  0.78% vim
 2402 jrm            1  44    0 29696K 18592K select   0:02  0.00% emacs
```

The 6th and 7th columns are SIZE and RES respectively.

You can customize it with elisp, which means you can easily write functions like the emacs-psycotherapist.


----------

