4 ms·
> Bash is great, but when it comes to writing scripts, people usually choose a more convenient programming language. JavaScript is a perfect choice um… what?
by hnarn 5y ago
> Bash is great, but when it comes to writing scripts, people usually choose a more convenient programming language. JavaScript is a perfect choice
um… what?
- FinalBriefing 5y agoIt is _a_ perfect choice. I know a bit of bash, but I'm always looking up how to do things I know are simple in JS. I would love to be able to write scripts in JS because I'm faster with it, and I find it easier to read.
- gbear0 5y agoin case anyone is looking to do this, it's as easy as doing the following #!/usr/bin/env node console.log("Hello World!");
- rickstanley 5y agoIn case anyone wondering how this is valid JS: - https://tc39.es/proposal-hashbang/out.html https://tc39.es/proposal-hashbang/out.html - https://github.com/tc39/proposal-hashbang https://github.com/tc39/proposal-hashbang - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#hashbang_comments https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- soheil 5y agoWhat is the nature of your outrage exactly? Bash is very difficult as a language to write code in. JS is very familiar to a lot of developers and its syntax is orders of magnitude easier to understand than Bash.
- runawaybottle 5y agoThe prejudice against JS developers is that they are seen as low class janitorial code monkeys by ‘real programmers’. It hurts these people even more because the language just succeeds and succeeds despite all the hate.
- xemdetia 5y agoI would say that it's more that Bash is good at something and JavaScript is good at other things and just because they are technically scripting languages doesn't mean that they are naturally a good fit in each other's domains. The README's comment tends to point towards an idea that all languages that can write scripts are equally interchangeable and of all choices JavaScript is the perfect choice. To people that are working on a variety of scripts in numerous languages who all have individual advantages and disadvantages, it comes off as nonsense.
- soheil 5y agoI think definitely there are better alternatives to JS in command line world like python but if someone decided to use something other than bash as a programming language that’s a win in my book. It has its place for basic scripts and general command line trickery but anything beyond that is using a hammer to do brain surgery.
- egeozcan 5y agoI do think JS would be much better than python. It's more to do with familiarity.
- thex10 5y agoyeah same. As a front-end webdev who writes JS frequently, I've _never_ written shell scripts and thought "Wow, I'd really rather use JavaScript for this"! Not saying it doesn't happen, just that it hasn't been my experience.
- lloydatkinson 5y agoYou’ve never written a bash script and needed to parse, format, concat lots of strings? What about arrays of strings? All of which is easier in just about any modern language.
- kakuri 5y agoAs a front-end dev who works with JS all the time and never writes shell scripts, every time I have to deal with shell scripts I think "I'd really rather use JS for this".
- SCLeo 5y agoI am also a frontend dev. My experience has been completely opposite from yours. Node.js is my go-to tool for writing automation scripts. I think these are some reasons why our mileages differ: - I need my scripts to work in both Windows and Linux. - I am not very experienced with bash or other shell. - Most of my "automation work" only involves reading text from a file, transform it, and write to another file. (Generating SQL commands, doing stats about town names, etc.)
- shomyo 5y agojs kids thse days.
- shell0x 5y agoI have never seen anyone using Javascript for scripting. Never. It's perfectly fine for app dev, but definitely not for running scripts on a server. I came across Bash, Powershell, Ruby, Python, Go, Rust, Perl, but JS?