#!/usr/bin/env bash capture="" if [[ $# -eq 1 ]] then capture="\1H,\2M,\3s" else capture="\1H,\2M" fi acpi -b | sed "s/.*\([0-9][0-9]\):\([0-9][0-9]\):\([0-9][0-9]\).*/$capture/g" | xargs echo