This page describes helper scripts that let you take a shortcut.
When bootstrapping a sandbox container or virtual machine, Instruqt injects a couple of 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.
Helper scripts assume the container or virtual machine has a POSIX shell available at
set-workdirare the most common helper scripts and are highlighted here.
fail-messagescript can be used to provide feedback to the learner when writing check scripts. The function will write a given string to
stdout, prefixed with
The fail message you want to show to the learner.
echo "Checking the solution of the challenge"
if [ !$EVERYTHING_WENT_WELL ]; then
fail-message "Your challenge failed because of REASON"
# which is equivalent to
echo "FAIL: Your challenge failed because of REASON"
The directory you want to set as the active working directory.
To set the
usrdirectory as the active working directory:
set-workdirscript is implemented using
$HOME/.bashrc. This means you will have to use
bashas the shell for the container or virtual machine.
If you don't have
bashavailable, you can achieve the same behavior by adding a
cd /path/to/workdircommand to the shell's profile (e.g.
When using the
ashshell (which most
busyboxbased containers do), you can also indicate that the
.bashrcprofile needs to be loaded. To do so, add an environment variable
$HOME/.bashrc. to the container's environment variables in the