Screen Too Small

This course material requires a larger screen to properly display the terminal and editor interfaces.

Please use a tablet, laptop, or desktop computer for the best learning experience.

You can continue browsing, but the experience will be significantly limited.

Vim Dojo challenge #3

Ship It or Sink: The Dev vs. Prod Toggle Script

Release imminent! Boss 'Captain Deadline' yells: 'SHIP IT OR WE SINK!'

You have one bash script with markers: #DEV_ONLY and #PROD_ONLY.

Rules:
- #DEV_ONLY → comment out (add leading #).
- #PROD_ONLY → uncomment (remove leading #).
- Both → Prod wins (line stays active).

Fix it in five minutes or suffer a 200-slide Lunch 'n Learn on our release process.

challenge.txt :set list

Start

 1#!/bin/bash
 2
 3echo "Starting Script..." #DEV_ONLY
 4
 5# echo "Debugging enabled!" #DEV_ONLY
 6
 7export API_KEY="P@ssw0rd" #DEV_ONLY
 8# export API_KEY="prod-super-secret" #PROD_ONLY
 9
10echo "Running test harness" #DEV_ONLY
11
12export LOG_LEVEL="DEBUG" #DEV_ONLY
13# export LOG_LEVEL="INFO" #PROD_ONLY
14
15echo "Mixed line" #DEV_ONLY #PROD_ONLY
16
17echo "All done."

Goal

 1#!/bin/bash
 2
 3# echo "Starting Script..." #DEV_ONLY
 4
 5# echo "Debugging enabled!" #DEV_ONLY
 6
 7# export API_KEY="P@ssw0rd" #DEV_ONLY
 8export API_KEY="prod-super-secret" #PROD_ONLY
 9
10# echo "Running test harness" #DEV_ONLY
11
12# export LOG_LEVEL="DEBUG" #DEV_ONLY
13export LOG_LEVEL="INFO" #PROD_ONLY
14
15echo "Mixed line" #DEV_ONLY #PROD_ONLY
16
17echo "All done."

Members only

Hold on, cowboy

You gotta sign in to take on challenges. New ones drop every week — they're fun, and insightful.