Shell commands

 features   2022-03-21

It’s easy to style shell commands and their outputs. Here’s a one-line command and a one-line output.

$
echo 1
1

You can pass multiple commands and multi-line output to the include as well:

$
echo 1
echo 2
1
2

However, it is recommended that you capture multi-line commands and outputs into variables and pass them. This is mostly because Liquid doesn’t like backslashes too much.

$
touch test.txt && \
    echo 123 >> test.txt && \
    echo 456 >> test.txt && \
    cat test.txt
123
456

You can display multiple commands one after another.

$
printf 'Hello\n'
Hello
$
printf 'World\n'
World

Only the last one will have a bottom margin.

Also, here’s a really long command with a really long output:

$
printf '%s\n' 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

This has the potential to look rather ugly due to scrollbars though, so please don’t do that.

Commands don’t necessarily have to have output:

$
mkdir test
$
cd test