File: out.PID

package info (click to toggle)
fastdnaml 1.2.2-6
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 576 kB
  • ctags: 384
  • sloc: ansic: 3,927; sh: 549; makefile: 22
file content (31 lines) | stat: -rw-r--r-- 759 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
30
31
#! /bin/sh
#
# Run a program, appending its process id to its output file name
#
outflag="-o"

if test $# -eq 2; then
    out="$2"
    set - "$1"
else
    while echo " $1" | grep "^ -" >/dev/null; do
        if test $# -lt 2;         then break
        elif test $1 = $outflag;  then out=$2; shift; shift
        elif test $1 = "-out";    then out=$2; shift; shift
        elif test $1 = "-";       then shift; break
        else echo "Bad flag:  $*" >&2; while test $# -gt 0; do shift; done; break
        fi
    done

    if test $# -lt 1; then
        comm=`echo $0 | sed -e 's&^.*/&&g'`
        echo "
Usage:  $comm  program  outfile
   or   $comm  $outflag outfile  program  [program_args]
" >&2
        exit
    fi
fi

echo "$$"
exec "$@" > "${out}.$$"