Home | History | Annotate | Line # | Download | only in test
mkscripts.sh revision 1.1
      1 #!/bin/sh -
      2 # This script generates ed test scripts (.ed) from .t files
      3 
      4 PATH="/bin:/usr/bin:/usr/local/bin/:."
      5 [ X"$ED" = X ] && ED="../ed"
      6 
      7 for i in *.t; do
      8 #	base=${i%.*}
      9 	base=`echo $i | sed 's/\..*/'`
     10 	(
     11 	echo "#!/bin/sh -" 
     12 	echo "$ED - <<\EOT" 
     13 	echo "r \\$base.d" 
     14 	cat $i 
     15 	echo "w \\$base.o" 
     16 	echo EOT
     17 	) >$base.ed
     18 	chmod +x $base.ed
     19 # The following is pretty ugly and not appropriate use of ed
     20 # but the point is that it can be done...
     21 #	base=`$ED - <<-EOF
     22 #	r !echo $i
     23 #	s/\..*
     24 #	EOF`
     25 #	$ED - <<-EOF
     26 #	a
     27 #	#!/bin/sh -
     28 #	$ED - <<\EOT
     29 #	r \\$base.d
     30 #	w \\$base.o
     31 #	EOT
     32 #	.
     33 #	-2r \\$i
     34 #	w \\$base.ed
     35 #	!chmod +x $base.ed
     36 #	EOF
     37 done
     38