add_fits_keyword (version 0.0)
You can also look at:
#! /usr/bin/ksh
###########################################################################
#
#
# SYNTAX: add_fits_keyword file keyword value comment
#
# DESCRIPTION: This function adds or updates a FITS keyword in a FITS file.
# Add occurs if the keyword is not found in the header.
#
# HISTORY:
#
# VERSION: 0.0
#
##############################################################################
file=$1
keyword=$2
value=$3
comment=$4
if [ -z "$file" ]; then
file="undefined"
fi
if [ -z "$file" ]; then
keyword="undefined"
fi
if [ -z "$file" ]; then
value="undefined"
fi
if [ -z "$comment" ]; then
#####################
# no comment
#####################
$FTOOLS/fparkey value="$value" \
fitsfile="$file" \
keyword="$keyword" \
add=yes >stdout.log 2>stderr${$}.log
$UTIL/ftool_test fparkey $? $0 1 stdout.log stderr${$}.log
else
#####################
# comment specified
#####################
$FTOOLS/fparkey value="$value" \
fitsfile="$file" \
keyword="$keyword" \
comm="$comment" \
add=yes >stdout.log 2>stderr${$}.log
$UTIL/ftool_test fparkey $? $0 1 stdout.log stderr${$}.log
fi
exit 0