#! /bin/sh
# DON'T change the "csh" above!

# Set the shell in a specific set of files to /bin/tcsh or $1.

shell=${1:-"/bin/tcsh"}

for file in makewalk \
	      makewalk.quiet \
	      make_ar_cleanup \
	      make_cond_build \
	      make_cond_compile \
	      make_list_files \
	      make_touch_src
do
    if head -1 $file | grep $shell >/dev/null; then
	:  ;# already there
    else
	save_dir=.save
	if [ ! -d $save_dir ]; then
	    echo Creating save directory $save_dir
	    mkdir $save_dir
	fi

	echo Modifying file $file

	mv -f $file $save_dir
	(echo "#!$shell -f"; tail +2 $save_dir/$file) > $file
	chmod a+x $file
    fi
done
