51/60
Sign inSign up free

503. Bump a Semantic Version

medium 20 XP ~10 minHands-on lab

Release pipelines bump the version before tagging. Write the helper they call.

Task

Create the executable script /home/student/bin/bump.sh PART [FILE]:

  • FILE defaults to VERSION in the current directory. It holds one version like 1.4.9 (MAJOR.MINOR.PATCH, numbers only).
  • PART is major, minor or patch:
    • major: 1.4.9 → 2.0.0
    • minor: 1.4.9 → 1.5.0
    • patch: 1.4.9 → 1.4.10
  • It writes the new version back to FILE (one line) and prints it on stdout.
  • Wrong usage (missing or unknown PART): print usage: bump.sh major|minor|patch [FILE] to stderr and exit 2.
  • If the file is missing or doesn't contain a valid version: print an error to stderr, exit 1, and leave the file unchanged.

About this machine

Ubuntu 24.04 with no internet access. You are student with passwordless sudo. The grader checks the final state of the machine, not the commands you typed. Values like names and ports are generated for you.

Teaching or writing about this? Embed this lab on your page

TerminalNot started

Your machine is ready to start

A fresh, isolated Ubuntu machine boots in a few seconds with the task already set up.

No account needed: 3 of 3 free tries left. Guest machines last 30 minutes.