Data and Math

vshlex

Splits and quotes a command line the way a shell would.

Released v1.0.0 · 2026-09-28
Import
use "stdlib/shlex.ven"

Shell style tokenizing and quoting, splitting a command line into its words the way a shell would and quoting a word safely for reuse in one, built on Venutian's own shell splitting builtin. It is meant for a program that has to build or read a command line safely, without writing its own quoting rules by hand.

vshlex.ven
print split("cp -v 'my file.txt' /tmp")
Reference (3 functions)

API reference

split(command)

Splits command into a list of shell-word tokens.

split("cp -v 'my file.txt' /tmp")

quote(s)

Quotes s so a POSIX shell reads it back as exactly one word.

quote("it's a test")

join(args)

Builds one shell command line out of args.

join(["cp", "-v", "my file.txt", "/tmp"])

Get notified when vshlex changes

Get notified about

New versions and security advisories.

New and updated packages, once a day.

News on the math model built in Venutian.