In my previous post I mentioned that I have a TextExpander shortcut which creates the basic format for me. I trigger it with ‘/ss’ (an un-creatively shortcut for “shell script”):
Here is an example of what it creates:
#!/bin/bash
#
# Author: Timothy J. Luoma
# Email: luomat at gmail dot com
# Date: 2011-06-16
#
# Purpose:
SOURCE="${HOME}/.source"
if [ -r "${SOURCE}" ]
then
. "${SOURCE}"
else
echo "$0: no ${SOURCE} found"
fi
exit 0
# EOF
But the TextExpander shortcut is this:
#!/bin/bash
#
# Author: Timothy J. Luoma
# Email: luomat at gmail dot com
# Date: %Y-%m-%d
#
# Purpose: %fill:name%
SOURCE="${HOME}/.source"
if [ -r "${SOURCE}" ]
then
. "${SOURCE}"
else
echo "$0: no ${SOURCE} found"
fi
%|
exit 0
# EOF
Note the place-holder for the date which automatically fills in today’s year-month-day, as well as %fill:name% which prompts me to put in a description of what the script does. Here’s what it looks like when I trigger it:

That reminds me to write a summary for it, which is helpful when I go back later and wonder “Now why did I write this?” It also means that I can fgrep for ‘Purpose: ’ in my ~/bin/ which can help me find the script I’m looking for if I can’t remember what I called it.
The %| tells TextExpander where to put the cursor where I can start writing the actual script. (I used to have it go to the “Purpose” line, but then I realized it was easier to use the ‘fill’ feature so I didn’t have to down-arrow past the dot-source block.)
What’s the point of the .source file? I explained that in my previous post.
(view comments)
-
clsnyder reblogged this from luoma
-
matsuda liked this
-
cleverhacks reblogged this from luoma
-
darkuncle liked this
-
redcloud liked this
-
luoma posted this