fidian / ansi

ANSI escape codes in pure bash - change text color, position the cursor, much more

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unbound variable $1

Hologos opened this issue · comments

Hi,

I am running script with set -euo pipefail and the library produces unbound variable error and stops the script.

#! /usr/bin/env bash

set -euo pipefail

. vendor/fidian/ansi/ansi

echo "this line gets printed"

fmt_bold="$(ansi --bold --no-restore)"

echo "this one does not"

ansi --underline --no-restore

echo "neither this one"
$ ./ansi-test.sh
this line gets printed
vendor/fidian/ansi/ansi: line 868: $1: unbound variable

You're absolutely right, and I thank you for reporting this error in my code!