20

Are there any IDEs targeted at shell scripting, specifically bash and zsh scripts? This means having syntax-highlighting for shell scripts and more importantly debugging environments with features like breakpoints, variable inspection and modification, etc., just like those available for regular programming languages like Python, Java, and C.

For instance Microsft Windows Powershell has IDEs like Powershell Plus and PowerGui.

Googling brought up a combination of ShellEd, an Eclipse plugin for editing shell scripts, and BashEclipse, a Bash debugger that works with ShellEd; I haven't tried it yet.

Are there any other shell scripting IDEs for Un*x similar to this combo? Does anyone have some experience with them?

  • 10
    I did not downvote but whoever did, did so because you are not asking a question. The only question in your post can be answered with a Yes/No. What are you actually asking? How do these programs work? What they do? What are you trying to do exactly? – terdon Mar 8 '14 at 22:48
  • 10
    A bash IDE? Nuclear fission to boil water for tea... – jasonwryan Mar 8 '14 at 23:00
  • 5
    Actually, having a bash debugger is a very good idea -- just as with any programming language, your code will be better if you step through each line in the debugger slowly, examine the variables, think about what the code is doing, etc. A debugger is the best way to do that, even if your program or script doesn't have bugs. You can get bashdb in most distributions, which will allow you to do that in text mode. Also, the aging DDD graphic debugger can be made to work with bashdb so you have a more "visual" experience. – Stabledog Mar 9 '14 at 5:59
  • 1
    Yes, certainly one can do that. And many do, and that's how they get by for years. If that suits you, I wouldn't try to convince you otherwise. In my opinion, its an inferior approach that taxes the brain with low-value tasks (like mentally keeping track of the values of variables, etc). The idea of a good debugger UI is freeing up those cycles for thinking about the program. In my experience, this matters -- you have more attention free to focus on thinking about what the program is doing if you're spending less of it on such things. – Stabledog Mar 10 '14 at 20:20
  • 1
    For those of us with electric kettles or ranges in the US or Europe, a good part of our baseload electrical generation is supplied by nuclear power plants, so when we boil water for tea, we are using nuclear fission, at least partially. – Andrew Janke Aug 20 '15 at 0:48
14

I wouldn't say it is either well known or well used but you might have a look to basheclipse:

enter image description here

I must admit I have no experience with basheclipse and even failed to install it due to an eclipse version mismatch.

On the other hand, I'm using bash and ksh93 specific debugging features, especially the trap ERR and trap DEBUG ones but not the debuggers based on them kshdb and bashdb

  • I find it rather ironic that your screen-shot is of a Windows-style window. – Agi Hammerthief Mar 10 '14 at 17:54
  • @NigelNquande To be honest, I'm not a basheclipse (or eclipse for that matter) user. I definitely use debugging features provided by ksh93 and bash, but no GUI. This screenshot is taken from the basheclipse site. It might be some gnome theme or just a real Windows 7 screenshot given the OS="cygwin" line. – jlliagre Mar 10 '14 at 21:11
  • Well, IMO, if you're going to do something, do it with boots on, not half-aed (but that's neither here nor there to anybody else). To me, bash on Windows seems half-ased when it works perfectly well in GNU/Linux. – Agi Hammerthief Mar 10 '14 at 21:15
  • @NigelNquande As I wrote, this isn't a screenshot of mine. In any case, I only use bash on Windows when I have no choice and cygwin is quite efficient to hide the underlying OS. – jlliagre Mar 10 '14 at 21:33
  • 1
    @user7000 I wrote and even failed to install it due to an eclipse version mismatch but I don't remember what eclipse version it was. Is is documented to work with Eclipse 4.5.2 though: sourceforge.net/projects/basheclipse/files/?source=navbar – jlliagre Dec 13 '17 at 7:55
8

A purpose-built IDE would sort of defeat the purpose of shell scripting, not to mention that it's nearly impossible to do, because most of what shell does is calling external commands - how do you debug that? Debugging with checkpoints is counterintuitive for a shell - shell scripts usually operate heavily on files and thus have destructive side-effects on every call. Scripting BY DESIGN works line-by line, so your "environment" is actually the terminal itself - you can always echo variables, your environment is always there for you, there is no "prescribed flow" that you would have to interrupt. You progressively do whatever you want to do, line by line, testing each time if you got what you wanted and then paste these lines into a script to use again. Any IDE would actually just disable most of what you can do in the shell itself.

For fully qualified scripting languages (Python, Perl etc) you do have all this, but bash/zsh/ksh/... are interactive "glue" for other commands and are their own debuggers.

However, most text editors will highlight the code for you, and emacs will (provided you find the right packages, I never bothered with doing that for shell scripts) provide programmable keyword completion. I believe vi can do that as well (don't start a flamewar here please).

  • 1
    How do you define a "fully qualified scripting language?" – Trevor Sullivan Dec 19 '15 at 4:44
  • 1
    @TrevorSullivan in his own way. Don't, please, give into the hate. – Det Nov 6 '16 at 21:36
  • @Det: It was a legitimate question -- if we can't all agree on a common, concrete definition of the phrase, then we might as well not have a discussion about it. I'm just curious what is meant by that phrase. – Trevor Sullivan Nov 7 '16 at 17:59
  • 2
    I don't agree IDEs defeat the purpose of shell scripting. You might want to clean up your shell scripts (e.g. inline extraneous variables, detect unused variables - which is what I'm trying to do in cleaning up my System V Init scripts which are getting unnecessarily long especially when duplicated from existing examples). – user7000 Dec 12 '17 at 23:55
  • 1
    I would also add that and IDE provides intellisense or other tools so I don't have to keep googling or looking at man pages to remember some stuff. It also allows me to keep all my scripts together in a project, step over lines, inspect incoming arguments, test loops and switches, break apart a pipe for inspection, etc. – cjbarth Dec 22 '17 at 15:09
1

encountered this issue my self , mean that I searched for bash script IDE , there is a lot of plugins on populare IDE just like eclipse and many other. but find it lots of work dealing with IDE's just to build small bash scripts. in the other hand working with editors cause lots of syntax errors and waste of time , not to mention it's not fun at all.

so I found a online bash script tool for building scripts , it's called http://bashops.net , it's online , immediately can start working on building bash script , without getting busy in any installation.

1

I also endorse the idea of using an IDE for bash scripts.

One can write bash scripts using the jupyter notebook.

The jupyter notebook can be installed via anaconda while a bash kernel for jupyter notebook (or jupyterlab) can be installed with the following commands (source):

pip install bash_kernel and

python -m bash_kernel.install

After that, you can select bash on a new launcher instance of anaconda navigator, as shown below.

The only thing is that (as far as I know) it does not work with commands that you have to input to the prompt, such as read or any other argument that you pass after calling the script. But other than that, it works pretty well.

enter image description here

1

Rogalmic wrote a VSCode plugin for bashdb.

0

I would like to suggest PyCharm Community edition with BashSupport plugin. This has excellent IDE functionalities with intellij intellisense.

New contributor
DexOnWeb is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.