Skip to main content

#!/usr/bin/env desh

The Deno-Enhanced Shell Environment
Inspired by Google zx


Version Deno Doc Issues Deno Version License
Deno Dot Land Third Party Module

Install / Update

# First-time installation
deno install --quiet --no-check --allow-all --unstable --reload --force --import-map=https://deno.land/x/desh/import_map.json --name desh https://deno.land/x/desh/desh.ts

# Upgrade current installation to latest version
desh upgrade

# Modify install to use a specific version
desh upgrade --version v1.1.0

Example

// examples/hello.ts

import { $, $s, $o, $e, echo } from 'https://deno.land/x/desh@v1.2.0/mod.ts';

const message = $1 ?? 'World';

const hello = await $`echo Hello ${message}!`; // use $ to run shell commands
echo('result of the process was %o', hello);

const stdout = await $o`pwd | cut -d/ -f2`; // use $o if you only want the trimmed stdout
echo('stdout was %o', stdout);

const stderr = await $e`echo sup >&2`; // use $e if you only want the trimmed stderr
echo('stderr was %o', stderr);

const exitCode = await $s`exit 34`; // use $s if you only want the exit code
echo('exit status was %d', exitCode);

Results of running the hello example