What is a javascript shell

275    Asked by DipikaAgarwal in Java , Asked on Oct 11, 2022

 Recently I've been working with JS and I'm very enthusiastic about this language. I know that there is node.js for running JS at server side, but is there a shell that uses JS as a scripting language? If such a thing exists, how usable & stable is it?

Answered by Daniel Cameron

Does this look desirable to you?


// Replace macros in each .js file
cd('lib');
ls('*.js').forEach(function(file) {
  sed('-i', 'BUILD_VERSION', 'v0.1.2', file);
  sed('-i', /.*REMOVE_THIS_LINE.*
/, '', file);
  sed('-i', /.*REPLACE_LINE_WITH_MACRO.*
/, cat('macro.js'), file);
});
cd('..');

If so, javascript shell could be interesting, it's

a portable (Windows included) implementation of Unix shell commands on top of the Node.js API.

I'm unsure if this could be used as a full-featured login shell, though. (Maybe with some wrapping?)

You could argue that it's not really a shell, but do you know TermKit? It's made of Node.js + Webkit, you could use JS to extend it (I guess); the shell language is still Bash(-ish).



Your Answer

Interviews

Parent Categories