File: fixpaths

package info (click to toggle)
openssh 1%3A4.3p2-9etch3
  • links: PTS
  • area: main
  • in suites: etch
  • size: 5,676 kB
  • ctags: 4,646
  • sloc: ansic: 55,511; sh: 7,505; makefile: 815; awk: 323; java: 91; perl: 71; csh: 1
file content (22 lines) | stat: -rwxr-xr-x 499 bytes parent folder | download | duplicates (24)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
#
# fixpaths  - substitute makefile variables into text files
# Usage: fixpaths -Dsomething=somethingelse ...

die() {
	echo $*
	exit -1
}

test -n "`echo $1|grep -- -D`" || \
	die $0: nothing to do - no substitutions listed!

test -n "`echo $1|grep -- '-D[^=]\+=[^ ]\+'`" || \
	die $0: error in command line arguments.

test -n "`echo $*|grep -- ' [^-]'`" || \
	die Usage: $0 '[-Dstring=replacement] [[infile] ...]'

sed `echo $*|sed -e 's/-D\([^=]\+\)=\([^ ]*\)/-e s=\1=\2=g/g'`

exit 0