File: restart

package info (click to toggle)
fastdnaml 1.2.1-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 516 kB
  • ctags: 379
  • sloc: ansic: 4,171; sh: 570; makefile: 64
file content (29 lines) | stat: -rw-r--r-- 688 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#! /bin/sh
#
# restart shell script
#
if test $# -ne 1; then echo "Usage:  $0  checkpoint_file"; exit; fi
file="$1"

if test ! -f "$file"; then echo "$0: $file: File not found"; exit; fi
lastTwoEnds=`egrep -n '((;)|(\)\.))[ 	]*$' "$file" |
             sed 's/^\([0-9]*\):.*$/\1/' |
             tail -2`
nFound=`echo $lastTwoEnds | wc -w`
if test $nFound -eq 0; then
    echo "$0: Unable to locate end of tree(s) in file"
    exit
fi

read first_line
echo "$first_line R"
cat -
# tail -1 "$file"

if test $nFound -eq 1; then
    cat "$file"
else
    penultimateEnd=`echo $lastTwoEnds | sed 's/^\([0-9]*\).*$/\1/'`
    lastStart=`expr $penultimateEnd + 1`
    tail +$lastStart "$file"
fi