|
|
|
|
|
by adamnew123456
2140 days ago
|
|
If you're open to learning it, Tcl is actually a good middle ground here. The
best way I can describe it is "structured shell script" - still very string
oriented, but the syntax and command set is much more well thought out, and
its better for building libraries in (having namespacing, among other things).
You even have a choice among object systems if you need one. You don't lose much in terms of shell interop though - the native exec command
understands a lot of the basics (file redirection, pipelining, background
execution). In the simplest case, it's just one more word: exec wget $URL
You do have simple exceptions too, which terminate by default unless you catch
them (unfortunately, the stack traces aren't really useful). AFAIK exec throws
on a non-zero exit, and you can use it in your own code too: # Dead
error "IO error"
# Not dead
if {catch [error "IO error"] error_or_result} {
# The error
puts "Caught: $error_or_result"
} else {
# The result
puts "OK: $error_or_result"
}
|
|