Color theme
0 day streak0 XPP1
BashLearn mode
MISSION 1 OF 1

Check a podcast caption

0 XP earned
Bash track: IntermediateMission: BeginnerString testsConditional commandsEmpty strings
Before you start this intermediate track

Terminal basics and command arguments. Quoting and expansion change how a command behaves.

Guided code reading and debugging. Runnable coding challenges are available in JavaScript, Python, and SQL.

x
0 / 2 challenges
LEARN THE CONCEPT

Understand it, then try it.

A podcast preview should announce whether a caption contains text. Inside Bash's [[ ]] conditional command, -n tests whether a string has nonzero length. An empty string fails that test, so execution follows else. This checks the value itself and does not read a file or require an external command.

quest.sh
caption=""if [[ -n "$caption" ]]; then    printf '%s\n' "Caption available"else    printf '%s\n' "Caption missing"fi

Run each mission independently with bash quest.sh in Bash 5 or later, using the default IFS value. Every command is a Bash builtin; the scripts create no files, contact no services, and need no command-line arguments.

Track the values line by line. Predict the result before running this example in your own editor.