views:

875

answers:

3

Our dev team is looking for an IDE like vi or nano or even textpad for windows that has the capability to autocomplete and error correction for bash or shell script for linux. Basically something similar to .NET autocompletion where you will be able to see if an

 if[ $# -ne 5 ]; then

has no space between the 5 and the ] will tell you.

I hope this question is simple and easy to answer. I have seen that vi in RHE use some coloring but in CentOS5 it does not shows the different colors. Non of them use error detection or auto-completion.

+1  A: 

Like most questions of this sort, the One True Answer is EMACS.

However, TextMate, BBEdit, and SubEthaEdit do nicely too.

Charlie Martin
+2  A: 

In vim, apart from adding syntax highlighting to show incorrect syntax (the "if" example would not highlight the if correctly) you can add this to your .vimrc:

autocmd FileType sh set makeprg=bash\ -n\ '%'
autocmd FileType sh let &efm = "%E%f:\ line\ %l:\ %m," . &efm

Now when you run :make it will check the syntax and jump to errors. Map :make to F5 and syntax checking is just a key press away.

rq
Thanks RQ. I will test this and report back. Thanks again.
Geo
+1  A: 

Red Hat splits up the VIM RPM's into vim-minimal, vim-enhanced and then some. You need the vim-enhanced RPM's to do syntax highlighting. As CentOS is nothing more than repackaged RHEL, the same goes for CentOS. And if it has to be for Windows: GVim is readily available.

You could see the syntax highlighting by itself as a form of error detection. If you make an error in parenthesis, curly braces or something, you'll see that you syntax highlighting breaks, showing you that there's something wrong and where it went wrong.

As for the completion: most commands in Bash are really short, but CTRL-N will autocomplete anything in a file you have used before in that file.

wzzrd