Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Examples

1_var_use.sh

MESSAGE="Hello World"

echo $MESSAGE
View CFG

1_var_use CFG

1_var_use_err.sh

echo $MESSAGE

Error:

  × Unmet Precondition
   ╭─[:1:7]
 1 │ echo $MESSAGE
   ·       ───┬───
   ·          ╰── Precondition EnvVarSet("MESSAGE") could not be met
   ╰────

2_var_unset.sh

foo=hello
foo_var=foo

unset foo_var

echo $foo
View CFG

2_var_unset CFG

2_var_unset_err.sh

foo=hello
foo_var=foo

unset $foo_var

echo $foo

Error:

  × Unmet Precondition
   ╭─[:6:7]
 5 │ 
 6 │ echo $foo
   ·       ─┬─
   ·        ╰── Precondition EnvVarSet("foo") could not be met
   ╰────

3_file_exists.sh

touch foo
rm foo
View CFG

3_file_exists CFG

3_file_exists_err.sh

touch foo

rm foo bar

Error:

  × Unmet Precondition
   ╭─[:3:8]
 2 │ 
 3 │ rm foo bar
   ·        ─┬─
   ·         ╰── Precondition FileExists("bar") could not be met
   ╰────

4_control_flow.sh

touch file.txt

if ping -c 1 google.com; then
    cat file.txt
fi

rm file.txt
View CFG

4_control_flow CFG

4_control_flow_err.sh

touch file.txt

if ping -c 1 google.com; then
    rm file.txt
fi

cat file.txt

Error:

  × Potentially Unmet Precondition
   ╭─[:7:5]
 6 │ 
 7 │ cat file.txt
   ·     ────┬───
   ·         ╰── FileExists("file.txt") not satisfied due to: Some("rm file.txt")
   ╰────