this post was submitted on 02 Dec 2025
80 points (100.0% liked)

Linux

10577 readers
367 users here now

A community for everything relating to the GNU/Linux operating system (except the memes!)

Also, check out:

Original icon base courtesy of lewing@isc.tamu.edu and The GIMP

founded 2 years ago
MODERATORS
 

My primary use case for Amber is when I need to write a Bash script but don't remember the silly syntax. My most recent Bash mistake was misusing test -n and test -z. In Amber, I can just use something == "" or len(something) == 0

you are viewing a single comment's thread
view the rest of the comments
[–] unhrpetby@sh.itjust.works 5 points 1 week ago (2 children)

I'm reminded of the horrid example showcased on the amber-lang website previously.

[–] Samueru_sama@programming.dev 1 points 1 week ago
[ "$age" \< 18 ] && {
	echo "I'm not an adult yet"
} || {
	echo "I'm an adult"
}

if you want to be using braces in if statements lol

[–] BB_C@programming.dev 1 points 1 week ago (1 children)

They know you can just do if ((age < 18)) in bash, right?

Or rather if ((10#$age < 18)) because age=021 would not be adult 😉 Hopefully, they protect against that at least.

(I had to double-check this stupid default is still a thing, since I moved to zsh many years ago.)

[–] jasory@programming.dev 1 points 4 days ago

bc can handle extended-precision integers, unlike bash which maps them to floats.