Command substitution runs a command and stores its stdout in a variable. It is a common way to build names, paths, and small reports.

Program

Play the script to watch printf produce text that becomes the value of stamp.

command_substitution.sh
#!/usr/bin/env bash

today="2026-05-28"
stamp="$(printf 'run-%s' "$today")"
echo "$stamp"
command substitution `$(...)` runs the command inside and replaces it with stdout.
printf `printf` formats text predictably and is often safer than `echo` for generated data.