Added a help message

This help message describes the features desired of this script.
Basic argument parsing implemented

The script will now parse the inputs and separate out the various flags
and parameters. Unfortunately, the use of getopt/eval set means that by
the time they're done with the input arguments, there is really no way
to tell if the input file name contains spaces or if there are multiple
file names that have been supplied. All semblance of shell-specific
quoting is gone by then.

So, the script will just check if whatever remains is a valid file that
can be read. If not, throw an error.

The script is ready to be executable. The main function will just list
the arguments it was able to parse.
Script is now executable
Begin implementing the main function

At this point, the main function simply tests if the input file is a
plain text file or not. If it is, the script exits successfully. If not,
an error is thrown.
Use the full path of the SRT file

This should make it safe to call from a different directory than the one
the file is in.
Splitting god function into multiple pieces

The first step is to fix the encoding, so the function is now renamed to
indicate that.
Use iconv to convert encoding to utf-8

The fixEncoding function now uses iconv to convert whatever encoding the
file came in with into utf-8. A temporary file is created using mktemp
to store the converted file and a copy of the main file is made to
preserve the original.
Simpler idiom to exit when a test fails
Two more ways for the program to flag an error

The first is when the step to make a back up copy of the original file
fails. It could fail, for example, if the user doesn't have write
permissions in the directory. In this case, the script would rather not
do anything.

The second way to fail is if the iconv command fails to complete the
conversion. In this case, the main file is still untouched and we've
even made a backup. So, no harm done if we exit.
Added a comment
Remove BOM at start of the file

UTF-8 encoded text files have no need of a byte-order mark and the
presence of one causes trouble for srttool. The byte order mark for
UTF-8 takes the form 0xEFBBBF and appears at the start of the file.
Use multiple temporary files to do each step

The encoding conversion step uses a temporary file just for itself.
Adjust delay and renumber entries

Both these operations are done by srttool. The tool doesn't support long
options. The -r flag turns on renumbering and the -d flag accepts a
delay in seconds. The output is written out to stdout.

In order to calculate the delay in seconds for srttool, I've used awk
instead of bc, as awk is more likely to be installed.
Handle srttool failures

Since srttool writes its output to stdout, shell redirection is used to
overwrite the original file. So, if srttool fails, the redirection has
the unfortunate side effect of wiping out the original file.

The script will now avoid that scenario by trying to copy the original
file back.
Failure to overwrite file after encoding change handled
Fix bug in delay/numbering adjustment

Mix up of input and output files. Sorted now.
Implement stretching of time intervals between entries

The srttool from the transcode package only allows stretching up to 60
seconds over 3600 seconds. This is an unnecessary limitation. Instead,
using mkvmerge/mkvextract from the mkvtoolnix package, arbitrary stretch
factors can be used. In essence, we're encoding an mkv file with nothing
but a subtitle and extracting the subtitle out.
Drop debugging data at end of file
Calculate delay and stretch earlier

Calculate and store delay and stretch in the appropriate form to use
with srttool and mkvmerge. This removes the need for local variables.
Version 1.0