Skip to content

Instantly share code, notes, and snippets.

@FND
Created February 28, 2009 06:42
Show Gist options
  • Save FND/71902 to your computer and use it in GitHub Desktop.
Save FND/71902 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# DEBUG
item="foo bar lorem ipsum"
item="foo bar t:2009-02-26 lorem ipsum"
item="foo bar t:2009-02-27 lorem ipsum"
item="foo bar t:2009-02-28 lorem ipsum"
# check for threshold
if [[ $item = *t:* ]]; then # check for threshold marker
# extract date -- TODO: check for valid date
threshold=${item##*t:}
threshold=${threshold%% *}
# check threshold against current date
threshold=$(echo $threshold | sed s/[^0-9]//g)
date=$(date +"%Y-%m-%d")
date=$(echo $date | sed s/[^0-9]//g)
if [ "$date" -ge "$threshold" ]; then
show=true
else
show=false
fi
else
show=true
fi
echo "$show: $item" # DEBUG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment