break
fi
- cmd="$cmd s/\b$x\b/\$ARGV[\$i]/g; \$i++;"
+ cmd="$cmd s/\\b$x\\b/\$ARGV[\$i]/g; \$i++;"
done
perl_line_filter "$cmd" -- "$@"
#
# - Debian (debian)
# - Gentoo (gentoo)
-# - Mac OS X (darwin)
# - Solaris/OpenSolaris (sun)
# - FreeBSD (freebsd)
#
echo debian
elif test -f /etc/gentoo-release; then
echo gentoo
- elif test x`uname` = xDarwin; then
- echo darwin
- elif test x`uname` = xSunOS; then
+ elif test x"`uname`" = xSunOS; then
echo sun
- elif test x`uname` = xFreeBSD; then
+ elif test x"`uname`" = xFreeBSD; then
echo freebsd
else
echo 'unsupported OS!' >&2
# Get all necessary paths.
pwd=`pwd`
- base=`printf '%s' "$2" | sed "s|\~|$HOME|"` # expand ~, some sh don't do it
+ base=`printf '%s' "$2" | sed "s|~|$HOME|"` # expand ~, some sh don't do it
base=`dirname "$base"`
source=`printf '%s' "$pwd/$1" | sed "s|$base/||"`
target=`basename "$2"`
# Abort if the target file exists and is no symbolic link. Prevents
# overwriting real files.
if test -e "$target" && test ! -h "$target"; then
- printf "link(): target '%s' exists already and is no symbolic link!\n" \
+ printf 'link(): target "%s" exists already and is no symbolic link!\n' \
"$target" >&2
exit 1
fi
# Make sure the source exists.
if test ! -e "$source"; then
- printf "link(): source '%s' doesn't exist!\n" "$source" >&2
+ printf 'link(): source "%s" does not exist!\n' "$source" >&2
exit 1
fi
# Create the new symbolic link; remove the old one if necessary.
- printf "link(): linking '%s' to '%s'\n" "$source" "$target"
+ printf 'link(): linking "%s" to "%s"\n' "$source" "$target"
rm -f "$target"
ln -s "$source" "$target"
# Go back to the directory where we were before.
- cd "$pwd"
+ cd "$pwd" || return 1
}
# Generate a file from a source file using a given command. A warning not to
file_tmp="$file.tmp"
else
# We only need this message if we generate a new file.
- printf "%s: generating from '%s' (%s)\n" \
+ printf '%s: generating from "%s" (%s)\n' \
"$file" "$file$extension" "$1"
- echo '###################################' >"$file"
- echo '# WARNING! DO NOT EDIT THIS FILE! #' >>"$file"
- echo '###################################' >>"$file"
- echo >>"$file"
- printf "# It was generated from '%s' on %s.\n" \
- "$file$extension" "`date`" >>"$file"
- echo >>"$file"
+ {
+ echo '###################################'
+ echo '# WARNING! DO NOT EDIT THIS FILE! #'
+ echo '###################################'
+ echo
+ printf '# It was generated from "%s" on %s.\n' \
+ "$file$extension" "`date`"
+ echo
+ } > "$file"
file_tmp="$file"
fi