Skip to content

Commit

Permalink
feat: run the arguments that we get
Browse files Browse the repository at this point in the history
  • Loading branch information
juliangp committed Jun 6, 2024
1 parent 3cebda5 commit a18daa9
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions run-shell-script.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,6 @@
#!/usr/bin/env bash

# turn on echo
# set -x
set -x

today=$(date +"%Y-%m-%d")
files=$(echo $* | xargs -n1 | egrep "machine-learning-cp.md|machine-learning.md|watsonx-ai.md|watsonx-ai-cp.md" | tr '\n' ' ')

function validate_lastupdated() {
cat $1 | grep lastupdated | awk '{print $2; exit}' | tr -d '"'
}

echo "Checking files $files for date $today"

for f in ${files}; do
last_updated=$(validate_lastupdated $f)
echo "Found last updated ${last_updated} in $f"
if [[ "${last_updated}" != "${today}" ]]; then
echo "***ERROR*** found wrong date in ${f}: expecting ${today} but found ${last_updated}"
exit 1
fi
done

exit 0
sh $*

0 comments on commit a18daa9

Please sign in to comment.