Sean B. Palmer, $date
- major.txt: date, year, title, name
$date
Sean B. Palmer, $date
- minor.txt: date, year, month, day
+'%A %a %B %b %C %c %D %d %E* %0* %e %F %G %g %H %h %I %j %k %l %M %m %n %O* %p %R %r %S %s %T %t %U %u %V %v %W %w %X %x %Y %y %Z %z %+ %%'
case day in
1|21|31) day=${day}st;;
2|22) day=${day}nd;;
3|23) day=${day}rd;;
*) day=${day}th;;
esac
function ordinal() {
case $1 in
1|21|31) echo ${1}st;;
2|22) echo ${1}nd;;
3|23) echo ${1}rd;;
*) echo ${1}th;;
esac
}
- major.txt: date, year, title, name
- minor.txt: date, year, month, day
Year=$(date +%Y)
Month=$(date +%m)
Day=$(date +%d)
Date="$(ordinal $Day) $(date +%B) $Year"
-e for edit
#!/bin/bash
# note - Make a Note of Something
# Copyright 2008, Sean B. Palmer, inamidst.com
# Licensed under the Eiffel Forum License 2.
function doc() {
echo "Usage: $0 [options] [ [ ] ]"
echo "Create a new note, with optional filename title"
echo " -e Edit: change existing, don't create a new note"
echo " -h Help: print out this message"
}
function error() {
echo "Error: $@. Try '$0 -h' for help" >&2
exit 1
}
Options=$(getopt e $* 2>&1) || error "$Options"
set -- $Options
while true
do test ! -z "$1" || break
case $1 in
-h) doc; exit;;
-e) Edit=1;;
--) shift; break;;
-*) error "Unknown argument. Try $0 -h for help";;
esac
done
function ordinal() {
case $1 in
1|21|31) echo ${1}st;;
2|22) echo ${1}nd;;
3|23) echo ${1}rd;;
*) echo ${1}th;;
esac
}
Year=$(date +%Y)
Month=$(date +%m)
Day=$(date +%d)
Date="$(ordinal $Day) $(date +%B) $Year"
Base=~/web/inamidst.com/www/whits/
function major() {
Name=$1; shift
Title=${@:--}
Filepath=@@
echo "
$Title
Sean B. Palmer, $Date
"
}
function minor() {
}
if (( $# > 0 ))
then major
else minor
fi