5 ms·
there are many cases that you have to use sh scripts, e.g. many IoT devices, embedded devices etc where python etc are just huge and slow.
by synergy20 3y ago
there are many cases that you have to use sh scripts, e.g. many IoT devices, embedded devices etc where python etc are just huge and slow.
- uxp8u61q 3y agoIf you wouldn't program it in Python, you wouldn't program it in sh either. You don't run shell scripts on embedded devices! Typically, an embedded device runs one program that basically acts as the whole OS for the device. There's no kernel or userspace to speak of. You're directly interfacing with the hardware, and that's it.
- pletnes 3y agoThis just isn’t true. Smart TVs run some linux/android, so do car infotainment, the list goes on. Old tumble dryers, vacuum cleaners - sure.
- uxp8u61q 3y agoThese appliances can run python scripts just fine, then. Try to read the whole context instead of focusing on one part of the comment. I'm writing in the context of an appliance that can't run python script. That means the resources are heavily constrained.
- treis 3y agoEh, there's like a 10x difference in speed between Python and Java/Go and probably like a 100x between Python and shell stuff. Definitely some devices in that range that can do shell stuff but not Python.
- lachlan_gray 3y agoThis probably explains why Mercedes-Benz is on the list of sponsors
- IshKebab 3y agoProperly designed IoT devices wouldn't have Bash at all in my book.
- kkfx 3y agoDid you know properly designed IoT devices on sale? Personally I have some IoT at home to automate the home itself especially for p.v. self-consumption and the best I was able to find and integrate can be described as crap... I failed to fined anything else... A simple example: I like to have some electricity switch/breakers automation, the best I've found are from Shelly Pro series, witch have a not really useful webserver built-in and not really useful APIs the rest are even worse having no wired versions at all. Why the hell not offer manual breaker + two wires for modbus so I do not need to fit ethernet wires and power in the same place? Why just finding classic ModBUS-tcp/MQTT wired devices is so hard? Things meant to be integrated does not need shiny UIs, need effective ways to integrate them, simple and reliable coms. My VMC witch is not a dirty cheap device have mobus support, unfortunately even the vendor do not know a full list of all registry and many of them does works "sometimes" like "write a 1 to switch from heating to passive ventilation", "sometimes works", so to integrate it I need to check if the command was "accepted" after 30" then re-check it after 40 because sometimes it flip back for unknown reasons... And the list is long...
- IshKebab 3y agoThere aren't very many unfortunately, but hopefully Matter will change that (I haven't looked into the protocol in detail tbh - been out of the IoT world for a while). MQTT is not a good solution. It's a very ad-hoc protocol that really only works if you are a programmer setting up a completely custom system. Obviously manufacturers are not going to cater to that miniscule market.
- morelisp 3y agoNot strident enough. Properly designed Ts wouldn't have I at all in my book.
- diego_sandoval 3y agoPossibly dumb question: Why not write it in a compiled language like C or Go?
- synergy20 3y agobecause it's a script, we have bash and c on a linux and we need both, same to embedded devices.
- paulddraper 3y agoBecause then you need a computer and build process. Or, pre compile it across all target platforms and have an install process.
- kkfx 3y agoPersonally because it's quick. Sometimes I just need to automate some set of CLI commands... Of course sometimes things evolve and it's time to replace the script with something more easy to handle at the new scale, but for simple stuff, meaning something that can fit a single page or two they are far quicker. BTW in a broad topic: a classic system with a user-programming language as the topmost human computer automation/interface is obviously better, but we have had such systems in the past and commercial reasons have push them to oblivion so...
- justapassenger 3y agoBash is perfect for interacting with console tools. If that’s what you need to do, C/go won’t only be much longer code, but also much harder and error prone. Command line tools are complex to deal with and there’s no magic bullet language for that.