Created
February 28, 2009 06:42
-
-
Save FND/71902 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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