|
|
|
|
|
by Wandfarbe
2138 days ago
|
|
I'm struggling today as well with this shit: I just wanna write a few small lines of a shell script which downloads stuff; It is very very stupid through what loops you hvae to jump to do this with curl and bash script in a good way including readability and error handling. Is a perl script really better? Perl 5,6 and 7 did not make it very sane to me, managing and installing and working with perl is also less trivial then having a shell like bash, sh or dash available to you. Something inbetween bash and go is missing, i like the approach of crush. I think thats the biggest misstake happening in bash: playing around with strings and auto expansion and substition etc. Its weird, its error prone, it doesn't have a proper clean well defined ecosysem. |
|
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:
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: