Try to guess sed options depending on system
This commit is contained in:
parent
29fda74bae
commit
94b9247181
@ -1,5 +1,20 @@
|
||||
#! /bin/sh
|
||||
|
||||
if [ ! -z "`which gsed >/dev/null`" ]; then
|
||||
sed=gsed
|
||||
ext_opt=-r
|
||||
else
|
||||
sed=sed
|
||||
case `uname` in
|
||||
Darwin|*BSD)
|
||||
ext_opt=-E
|
||||
;;
|
||||
*)
|
||||
ext_opt=-r
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ $# != 2 ]; then
|
||||
echo "usage: $0 src_file dst_file" > /dev/stderr
|
||||
exit 1
|
||||
@ -9,12 +24,12 @@ src="$1"
|
||||
dst="$2"
|
||||
|
||||
do_xml() {
|
||||
sed -e 's@<_@<@g' -e 's@</_@</@g' "$src" > "$dst.tmp" || exit 1
|
||||
$sed -e 's@<_@<@g' -e 's@</_@</@g' "$src" > "$dst.tmp" || exit 1
|
||||
mv "$dst.tmp" "$dst" || exit1
|
||||
}
|
||||
|
||||
do_desktop() {
|
||||
sed -r -e 's@^_(\w+)=@\1=@g' "$src" > "$dst.tmp" || exit 1
|
||||
$sed $ext_opt -e 's@^_(\w+)=@\1=@g' "$src" > "$dst.tmp" || exit 1
|
||||
mv "$dst.tmp" "$dst" || exit1
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user