scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

0003-append.sh (555B)


      1 #!/bin/sh
      2 
      3 set -e
      4 
      5 tmp1=`mktemp`
      6 tmp2=`mktemp`
      7 
      8 trap "rm -f file* f1 f2 f3 $tmp1 $tmp2; exit" 0 2 3
      9 
     10 ###########################################################################
     11 #Append generated files at once to an existing archive
     12 
     13 echo First > file-1
     14 echo Second > file-2
     15 echo Third > file-3
     16 
     17 cp master.a file.a
     18 ar -qv file.a file-1 file-2 file-3
     19 
     20 ar -t file.a file-1 file-2 file-3 > $tmp1
     21 
     22 cat <<EOF > $tmp2
     23 file-1
     24 file-2
     25 file-3
     26 EOF
     27 
     28 cmp $tmp1 $tmp2
     29 
     30 ar -p file.a file-1 file-2 file-3 > $tmp1
     31 
     32 cat <<EOF > $tmp2
     33 First
     34 Second
     35 Third
     36 EOF
     37 
     38 cmp $tmp1 $tmp2