News for hackers. Stuff that matters.
Re:Minimal safe Bash script template by usr1106 on Tuesday December 15, 2020 @07:09AM (#25429519)
Depends. In an embedded system I prefer not to have to install Python at all.
Re:Minimal safe Bash script template by franga2000 on Tuesday December 15, 2020 @07:29AM (#25429647)
In an embedded system (== very limited resources), wouldn't you want to avoid any interpreted language, even shell? We have some very nice languages that compile to machine code these days
Re:Minimal safe Bash script template by usr1106 on Tuesday December 15, 2020 @07:50AM (#25429782)
Well, there is embedded and embedded embedded :)

I was talking about embedded Linux here, so 512 MB RAM is not really uncommon, many systems have even more. No problem to run even bash. dash is sometimes preferred for license reasons, busybox ash is smaller, but then programming can probably get more annoying already, because useful features are probably missing. I use dash regularly for scripting (interactive use is a pain), haven't had to use ash for a while.

Of course there are much smaller embedded systems. But I don't think they would run Linux.

Re:Minimal safe Bash script template by alexhutcheson on Tuesday December 15, 2020 @08:48AM (#25430234)
Rob Landley is working on implementing a full Bash clone (called toysh[1]) in his Toybox project[2]. I'm excited for it to be released - it will be a huge improvement vs. Busybox ash for embedded environments. We'll be able to write scripts that use arrays!

[1] https://github.com/landley/toybox/blob/master/toys/pending/s...

[2] http://landley.net/toybox/about.html

Re:Minimal safe Bash script template by colonwqbang on Tuesday December 15, 2020 @07:48AM (#25429768)
If we're talking Linux embedded and not something like an MCU, then you already likely have a shell installed. So you might as well use it for the things which shell excels at. Shell scripts are much smaller in size than the equivalent C code, for those things that shell is typically used for.
Re:Minimal safe Bash script template by im3w1l on Tuesday December 15, 2020 @07:34AM (#25429682)
BASIC is 56 years old. Computers back then were not very fast, but interpretation was still viable.
Re:Minimal safe Bash script template by usr1106 on Tuesday December 15, 2020 @07:52AM (#25429803)
Have used it on 7KB RAM :) But to be fair the interpreter was in ROM, no idea how big that was.
Re:Minimal safe Bash script template by teddyh on Tuesday December 15, 2020 @11:31AM (#25431803)
ROM was usually very slow, so all ROM content was usually copied to RAM before execution. RAM size was therefore still an issue.
Re:Minimal safe Bash script template by usr1106 on Tuesday December 15, 2020 @07:42PM (#25437530)
I am pretty sure the PET-2001 didn't do that. 8 KB was all it had, about 1 KB was used by the operating system and 7 KB where available for programming. Actually something you would call byte code today, every basic command was 1 Byte. Just don't use labels with 4 or 5 characters, that wastes a lot of space!

The first models came even with 4 KB RAM / 3 KB usable. Have never seen one of those, though.