I've had a considerably more sophisticated script for constructing my AppleScript headers for many years, but I've never written one for the shell scripts I write in BBEdit.
This morning I decided I'd fix that and write a custom-header-constructor for BBEdit.
I'll probably customize it more after I use it for a while, but here are the bones:
------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2010/10/11 21:32
# dMod: 2017/05/10 09:29
# Appl: BBEdit
# Task: Insert info header into the front document.
# Libs: None
# Osax: Satimage.osax
# Tags: @Applescript, @Script, @Satimage.osax, @BBEdit, @Insert, @Attribution, @Info, @Header
------------------------------------------------------------------------------
set dateTime to do shell script "date '+%Y/%m/%d %R'"
set headerTextTemplate to text 2 thru -1 of "
# Auth: Christopher Stone
# dCre: " & dateTime & "
# dMod: " & dateTime & "
# Task:
# Tags: @Shell, @Script
"
tell application "BBEdit"
tell front text document
if contents of line 1 starts with "#!" then -- Shebang line
set start_Line to line 2
else
set start_Line to line 1
end if
set before start_Line to headerTextTemplate
set findRec to find "^# Task: " options {search mode:grep, case sensitive:false, starting at top:true}
select insertion point after found object of findRec
end tell
end tell
------------------------------------------------------------------------------
Enjoy.