#!/bin/sh
#
# modifyscript - add the image line to the specified file
#

cd /usr/weber/ascrpt/

Gif_name=$2
TNAME0=/usr/weber/ascrpt/$1
TNAME1=/tmp/tmpmodify

awk 'BEGIN{
gif_flag=0;
new_line="";
}
{
if(index($0,"images/" and GIF_NAME)!=0){
gif_flag=1
}
if(index($0,"INSTRUCTIONS:")!=0){
	if(gif_flag==0){
	gif_flag=1;
	new_line="!A~ image location - images/" and GIF_NAME;
	print new_line;
	new_line="!A";
	print new_line;}
}
print $0;
} ' "GIF_NAME=$Gif_name" < $TNAME0 > $TNAME1

mv $TNAME1 $TNAME0
