next | next | up | down | Inhalt | Uebungen | Complete | Kommentar

all, section 8.2.

8.2.  Archivierung mit der sh

Man kann auch mit der sh(1), archivieren. Es gibt allerdings Probleme, wenn die Dateien binäre Daten enthalten.

 1      :       Bourne Shell
 2      #       bundle -- 1.2 Jun 22 06:17:04 1987
 3      #       Copyright (c) 1987 Axel T. Schreiner
 4      
 5      #       bundle file... directory...
 6      
 7              tmp=/tmp/bundle$$
 8      
 9      case $1
10      in -r)  rflag=y; shift
11      ;; *)   rflag=n
12              echo ': to unbundle set umask and sh this file'
13              echo 'trap "rm -f /tmp/bundle$$" 1 2 3 15'
14              echo 'exec > /tmp/bundle$$'; exec 3> $tmp
15      esac
16      
17      for i 
18      do      echo "echo >&2 $i"; echo >&2 $i
19              if [ -d $i ]
20              then    echo "[ -d $i ] || mkdir $i"
21                      bundle -r $i/*
22              else    echo "sed 's/^  //' > $i << 'End of $i'"
23                      sed 's/^/       /' $i
24                      echo "End of $i"
25                      echo "wc $i"; wc $i >&3
26                      [ -x $i ] && echo "chmod +x $i"
27              fi
28              [ -w $i ] || echo "chmod -w $i"
29      done
30      
31      case $rflag
32      in n)   echo "diff -b - /tmp/bundle\$\$ << 'End of wc' >&2"
33              exec 3>&-
34              cat $tmp; rm $tmp
35              echo 'End of wc'
36              echo 'rm -f /tmp/bundle$$'
37              echo 'exit 0'
38      esac


back | next | up | down | Inhalt | Uebungen | Complete | Kommentar


Created by unroff & hp-tools. © by Hans-Peter Bischof. All Rights Reserved (1997).

Last modified 03/July/97