From a973393b28965ef84ff6c4056e8ddadee27b8463 Mon Sep 17 00:00:00 2001 From: Benoit S Date: Sun, 29 Aug 2021 09:51:27 +0900 Subject: [PATCH] Add a check_command --- tootpaste.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tootpaste.sh b/tootpaste.sh index ea02d5b..4e2d24a 100644 --- a/tootpaste.sh +++ b/tootpaste.sh @@ -118,6 +118,14 @@ statuses_remove(){ $DRY_RUN || $TOOTCTL statuses remove --days "$STATUSES_REMOVE_DAYS" } +check_command(){ + command -v "$1" > /dev/null +} + +for command in $TOOTCTL curl grep awk cut sort; do + check_command "$command" || (echo "$command not found, exiting..."; exit 1) +done + $DO_ACCOUNTS_CULL && accounts_cull $DO_MEDIA_REMOVE && media_remove $DO_STATUSES_REMOVE && statuses_remove