ls /home/jao | map (lambda f: (f, f.size))
https://github.com/geophile/marcelThe syntax is something like this:
text=@(ls -lh).replace('a','b').split('b')Disclaimer: I work at Microsoft, but not on PowerShell.
use IPC::System::Simple qw(capture);
use Sub::Install qw(install_sub);
foreach my $command (qw(foo bar baz)) {
install_sub $command => sub { capture($command, @_) }
}
...
my $output = foo($x, $y); # will throw if calling 'foo $x $y' returns non-zero
(there's a Shell.pm but it's not as helpful with errors; I should probably consider rewriting it a more modern way)Note that if you're distributing code p3rl.org/App::FatPacker will produce a single fat script that has (pure perl) dependencies included so you don't need to install anything (except for having a perl VM in $PATH).
There's also multiple libraries that provide a '$' function in JS (which may be why amber picked that delimeter) and then you can do
let output = await $`foo ${x} ${y}`;
(the template string's variable parts get autoquoted)Note that bun.sh has a 'bun compile' subcommand that bolts together your (pure JS) code and the static bun binary to produce a single file you can also copy around.
I'd suggest avoiding backticks in ... everything. In shell, $() is nicer, and both perl's and ruby's backticks require effort to use safely.
No idea re python but I see no reason you couldn't do the function generation thing if you wanted to, and somebody's probably librarified it already.
Most high-level languages have packages that implement DSLs for running and connecting subprocesses. Python has both `subprocess` in stdlib and things like plumbum (https://plumbum.readthedocs.io/en/latest/index.html) or fabric as 3rd party packages. Scala has a little DSL ("echo 1" #| "cat" !) for this in stdlib. How lightweight the syntax is depends on how DSL-friendly the language is, so things like Ruby or Raku might be your best bets.
Maybe there are existing scripting langs that make this so? Ambers approach is not bad but I feel it could be even better.