sbase

suckless unix tools
git clone git://git.suckless.org/sbase
Log | Files | Refs | README | LICENSE

0005-ed.sh (198B)


      1 #!/bin/sh
      2 
      3 set -e
      4 
      5 tmp1=tmp1.$$
      6 
      7 cleanup()
      8 {
      9 	st=$?
     10 	rm -f $tmp1
     11 	exit $st
     12 }
     13 
     14 trap cleanup EXIT
     15 
     16 ../ed <<EOF >$tmp1
     17 i
     18 foo
     19 bar
     20 .
     21 ,t
     22 1t
     23 2t
     24 2,3t
     25 3,7p
     26 EOF
     27 
     28 diff -u - $tmp1 <<EOF
     29 foo
     30 bar
     31 foo
     32 bar
     33 bar
     34 EOF