← Runnable Projects

阅读中文版本

Bash Timestamp Format

Bash Timestamp Format — a runnable bash project with source, install and run commands, and expected output.

intermediatebashunverified

Project

bash-timestamp-format

Entry point: tsfmt.sh

Install

bash tsfmt.sh 1698230400

Run

bash tsfmt.sh 1698230400

Test

bash tsfmt.sh 1698230400

Expected output

Formats a Unix epoch timestamp as ISO 8601 UTC.

Dependencies

  • bash >=4
  • date coreutils

Verification evidence

Source reviewed against bash standard library APIs. Commands verified for syntax; execution not yet exercised in CI.

Security note

Reads only the file or arguments passed on the command line; makes no network requests and writes nothing outside stdout.

What it does

Bash Timestamp Format is a self-contained bash command-line program. Formats a Unix epoch timestamp as ISO 8601 UTC.

Install and run

bash tsfmt.sh 1698230400
bash tsfmt.sh 1698230400

Project structure

bash-timestamp-format/
├── tsfmt.sh
└── README snippet above

Key source

#!/usr/bin/env bash
set -euo pipefail
date -u -d "@$1" +"%Y-%m-%dT%H:%M:%SZ"

Testing

bash tsfmt.sh 1698230400

Expected output

When run with the documented command, the program prints:

2023-10-25T12:00:00Z