linuxscriptingpackagelinux-from-scratch

Anyone know of any statically-typed scripting languages?


I'm about to start an LFS-based linux distro just for a hobby project. I plan on doing some very non-standard tasks, and most of it will involve change almost all scripts in the distro. (mainly init scripts, but also I'll be writing a simple set of package manager scripts.) Since I'm gonna be going this far off the norm, and since I have never been a fan of dynamic-typed languages (perl, python, bash and the rest are good, but just not my forte), I was wondering if anyone knew of an interpreted language that actually has declared variables.


Solution

  • Look in to the "typeset" command in your favorite shell. bash and ksh93 both can enforce integers and strings, use references (variable variables), etc. With ksh93, you can also do floating-point math and use objects with attributes. Static typing doesn't really buy you anything useful in init scripts and similar. You're primarily going to be reading files and running system commands - which is what the shell's really good at. Take some time with the O'Reilly "learning the Korn Shell" book before deciding that all those other Unixes are stupidly designed... ;)