Skip to content

Instantly share code, notes, and snippets.

@moukrea
Created August 26, 2022 08:41
Show Gist options
  • Save moukrea/94c972a41355099e488bbf03534d3e44 to your computer and use it in GitHub Desktop.
Save moukrea/94c972a41355099e488bbf03534d3e44 to your computer and use it in GitHub Desktop.
Bench duration of any command/script block using bash
#!/bin/bash
COMMAND=${1}
if [[ ${COMMAND} == "" ]]; then
echo "[ERROR] No command to bench, terminating..."
exit 1
fi
DATE_INIT=$(date +%s) ; \
${COMMAND}; \
echo "Command took $(($(date +%s)-DATE_INIT)) seconds"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment