by Alex Nadalin

ABS 1.2: background commands & the ability to import files

ABS is a programming language that puts together the productivity of bash scripts with the elegance of high-level languages such as Python or Ruby. It lets you issue system commands by simply wrapping them in backticks (very similar to how you would do it in Bash) and lets you use their output with clear and concise syntax.

This is, for example, a script that would try to issue a curl command, and exit if the server at would not reply within 10 seconds:


A few weeks ago the ABS team managed to pull together a new minor release of the language, 1.2.0, which includes loads of interesting features — let’s get to them!


ABS will now look for a default ~/.absrc file to preload every time you run a script. This is especially useful if you’d like to dump “base” functions you’re likely to re-use across scripts in a common place. Your .absrc could look like:

tenth = f(x) {   return x / 10 }

so that in any other abs script you can tenth(x).


We also introduced an history file in order to be able to repeat commands easily when using the ABS repl. This is, by default, located at ~/.abs_history and gets synced every time you close a repl session:

$ absHello alex, welcome to the ABS (1.2.0) programming language!Type 'quit' when you're done, 'help' if you get lost!⧐  `sleep 1`
⧐  quitAdios!$ tail ~/.abs_history`sleep 1`


A big one here: you can now require external files through require(path/to/file.abs ).

This is a stepping stone that allows creating base libraries that can be re-used across ABS scripts, and organizes ABS code a tad better.

Background commands

Another big feature here: you can now issue “background” commands that won’t block your ABS script (these commands are executed within a Goroutine).

A background command differs from a regular one simply because it employs an & at the end of the command itself — let’s see them in action:

`sleep 10`echo("Hello world!") # This will be printed after 10s
`sleep 10 &`echo("Hello world!") # This will be printed immediately

You can check whether a background command is done with the .done property:

cmd = `sleep 10 &`cmd.done # falsewait(10000)cmd.done # true

and we’ve added the wait() function if you need to block until the command is done:

cmd = `sleep 10 &`cmd.wait() # The script will be blocked for 10secho("Hello world!")


A few more features that made it into this release:

  • number functions such as floor, round and ceil
  • cd(), which switches the cwd of a script
  • you can play around with your prompt by setting the environment variables ABS_PROMPT_LIVE_PREFIX=true and ABS_PROMPT_PREFIX=templated_string. The templated string can use {dir}, {user}, {host} that will be replaced on-the-fly. For further info, have a look at the sample .absrc file


As usual, we managed to fix some minor bugs along the way:

  • fixed a few random panics when calling built-in functions without enough arguments (#193)
  • windows commands are now using cmd.exe rather than bash, as bash might not be available on the system (#180)
  • better error messages when parsing “invalid” numbers (#182)
  • the ABS installer was not working with wget 1.20.1 (#178)
  • the ABS parser now supports numbers in scientific notation (eg. 8.366100560806463e-7, #174)
  • errors on built-in functions would not report the correct error line / column numbers (#168)

Now what?

Install ABS with a simple one-liner:

bash <(curl

…and start scripting like it’s 2019!

PS: Again, many thanks to Erich, who’s been taking a larger role as the weeks went by. Without him, many of the stuff included in 1.2 wouldn’t be possible!

PPS: 1.3.0 is already well underway — expect it at some point in April. We’ll be introducing extremely interesting features such as the ability to kill background commands, so it’s going to be an exciting release!

Originally published at (21st March 2019).
You can follow me on Twitter — rants are welcome! ?