#!/bin/bash

file=$1/protect_output.reg

output=$1/safe_rob1.ctl
value=0

while read line 
do
	value=`expr $value + 1`;

done <$file
echo $value

val=0
echo "!( " > $output
while read line 
do
	val=`expr $val + 1`;
	if [ $val -eq $value ] 
	then
		echo "(${line} = 1 ^ ${line}G = 0)" >> $output
	else
		echo "(${line} = 1 ^ ${line}G = 0) * "  >> $output
	fi

done <$file
echo ");"  >> $output

	

