Timestamp strings are useful in generated names when the value is provided explicitly. This keeps the script reproducible and the name predictable.

Program

Play the script to choose the timestamp and see the generated artifact name.

stamp
timestamp_name_plan.sh
Replay: real traced execution (multi-file project)
#!/usr/bin/env bash

stamp="20260601T120000Z"
prefix="backup"
name="$prefix-$stamp.tgz"
echo "$name"
#!/usr/bin/env bash

stamp="20260601T121500Z"
prefix="backup"
name="$prefix-$stamp.tgz"
echo "$name"
  1. stamp ← 20260601T120000Z

    3stamp="20260601T120000Z"4prefix="backup"
    values this step20260601T120000Zstamp
  2. prefix ← backup

    3stamp="20260601T120000Z"4prefix="backup"5name="$prefix-$stamp.tgz"
    values this stepbackupprefix
  3. name ← backup-20260601T120000Z.tgz

    4prefix="backup"5name="$prefix-$stamp.tgz"6echo "$name"
    values this stepbackup-20260601T120000Z.tgznamebackupprefix20260601T120000Zstamp
  4. echo "$name"

    5name="$prefix-$stamp.tgz"6echo "$name"
    outputbackup-20260601T120000Z.tgz
    values this stepbackup-20260601T120000Z.tgzname
  1. stamp ← 20260601T121500Z

    3stamp="20260601T121500Z"4prefix="backup"
    values this step20260601T121500Zstamp
  2. prefix ← backup

    3stamp="20260601T121500Z"4prefix="backup"5name="$prefix-$stamp.tgz"
    values this stepbackupprefix
  3. name ← backup-20260601T121500Z.tgz

    4prefix="backup"5name="$prefix-$stamp.tgz"6echo "$name"
    values this stepbackup-20260601T121500Z.tgznamebackupprefix20260601T121500Zstamp
  4. echo "$name"

    5name="$prefix-$stamp.tgz"6echo "$name"
    outputbackup-20260601T121500Z.tgz
    values this stepbackup-20260601T121500Z.tgzname
timestamp A timestamp label records a specific instant-like value.
UTC suffix `Z` conventionally marks a UTC timestamp string.
reproducible name Passing the timestamp in makes the script output predictable.