Helper scripts
Helper scripts are pre-written scripts to help implement lifecycle scripts.
Overview
When bootstrapping a sandbox container or virtual machine, Instruqt injects some helper scripts. These scripts assist you in setting up the environment or applying check scripts. See the currently available set of helper scripts on GitHub.
This article covers the following helper scripts:
fail-message
set-workdir
fail-message
fail-message
The fail-message
helper script provides feedback to the learner when writing check scripts. The function will write a given string to stdout
, prefixed with FAIL:
.
fail-message "your fail message here..."
Consider the following example:
#!/bin/bash
if [ !$EVERYTHING_WENT_WELL ]; then
fail-message "Your challenge failed because of REASON"
exit 1
fi
Without the helper script, the format would be:
#!/bin/bash
if [ !$EVERYTHING_WENT_WELL ]; then
echo "FAIL: Your challenge failed because of REASON"
exit 1
fi
set-workdir
set-workdir
The set-workdir
script can be used to change the active working directory for a terminal tab from a challenge setup script.
set-workdir <dir>
Example
Consider the following example, which sets the usr
directory as the active working directory:
#!/bin/bash
set-workdir usr
Last updated
Was this helpful?