Hacker News new | ask | show | jobs
by manlobster 755 days ago
I don't love the $...$ syntax for executing commands. Using $ as a string delimiter is very strange to my bash-accustomed eyes.

It's a shame that they provided such weird syntax for the most important thing you tend to do in a bash script, while providing fairly nice syntax for everything else.

1 comments

and i dont like how it's inconsistent that echo is not using the $ syntax (which makes sense internally, as it's a built-in, rather than executing the $echo command).

Overall, it is cute and neat, but i find that if you are looking to write bash scripts that require this level of programming, you'd be better off writing it in python, or perl. Only in very austere environments can this be utilized, but the requirement of having `bc` installed means you must also have the ability to run package installation, so might as well run the package installation for a full on programming language!

I think that this does fill a niche. You can still compile to bash outside of this austere environment, and run the scripts within it. And python isn't very ergonomic for running external shell commands (or, say accessing environment variables), the syntax for doing so in amber looks much neater.
> the requirement of having `bc` installed means you must also have the ability to run package installation

I don't remember ever installing bc, but I use it frequently and it's always there. Are you sure it's not already part of most base systems?

No, it's often not, it's one of the common package you install manually to compile a linux kernel
> I don't remember ever installing bc, but I use it frequently and it's always there. Are you sure it's not already part of most base systems?

In my bash scripts, using `bc` makes my script not work on git-bash under Windows. Almost everything else I do in a script that isn't linux-specific (including netcat/nc usage) runs in git-bash for Windows.

It's not pre-installed on Debian and SUSE.
It's part of posix and should be available anywhere a posix like environment is offered.
Shelling out to awk would be a more portable choice than bc, though awk would bring you much closer to the featureset of Amber to begin with.