This was a regisnation letter of mine. (A very tough decision to leave that team behind; they're missed greatly).
#!/usr/bin/env bash
set -Eeuo pipefail
very_small_shell_script () {
declare robot="$1"
declare -a she_said=(
"Ok, great!"
"That's what she said."
"That's what he said."
"This should be okay for us."
"That almost never happens."
"What could possibly go wrong?"
"Have you tried turning it off and on again?"
"That's not how I would have made it. I would have made fish curry."
"You have partridge? Bring the partridge!"
"Oh, there's an on switch on the printer?"
"Am I doing it wrong?"
"I miss you guys. You're my little munchkins."
"It wasn't me. I didn't do it. It was like that when I got here. It's always been that way. I was dead at the time."
"What, the, actual, fork?!!"
"But why?"
"I do not understand the question."
"Correct!"
"r"
"True North!"
)
while true ; do
echo "$robot says '${she_said[$RANDOM % ${#she_said[@]} ]}'"
sleep $[ ( $RANDOM % 10 ) + 1 ]s
done
}
replace_employee_with () {
echo "Replacing $1 with $2 ..."
eval "$2" "$@"
}
main () {
declare date="date"
if [[ "$(uname -s)" = "Darwin" ]]; then date="gdate"; fi
declare employee="${1:-Nicola}"
declare -i commencement="$($date -d "2015-01-15 09:00:00" +"%s")"
declare -ir notice_period=30
declare -i tenure_days=1182
if [[ $(date +%s) -ge $(( commencement + ( ( tenure_days - notice_period ) * 86400 ) )) ]]; then
replace_employee_with "$employee" "very_small_shell_script"
fi
echo "Keep calm and carry on."
}
main "$@"