mirror of https://git.tukaani.org/xz.git
Scripts: Use printf instead of echo in a few places.
It's a good habbit as echo has some portability corner cases when the string contents can be anything.
This commit is contained in:
parent
0e222bf7d7
commit
4a61867a87
|
@ -51,7 +51,7 @@ escape='
|
||||||
while :; do
|
while :; do
|
||||||
case $1 in
|
case $1 in
|
||||||
--h*) printf '%s\n' "$usage" || exit 2; exit;;
|
--h*) printf '%s\n' "$usage" || exit 2; exit;;
|
||||||
--v*) echo "$version" || exit 2; exit;;
|
--v*) printf '%s\n' "$version" || exit 2; exit;;
|
||||||
--) shift; break;;
|
--) shift; break;;
|
||||||
-*\'*) cmp="$cmp '"`printf '%sX\n' "$1" | sed "$escape"`;;
|
-*\'*) cmp="$cmp '"`printf '%sX\n' "$1" | sed "$escape"`;;
|
||||||
-?*) cmp="$cmp '$1'";;
|
-?*) cmp="$cmp '$1'";;
|
||||||
|
@ -83,7 +83,7 @@ if test $# -eq 1; then
|
||||||
*[-.]zst | *.tzst)
|
*[-.]zst | *.tzst)
|
||||||
xz1='zstd -q';;
|
xz1='zstd -q';;
|
||||||
*)
|
*)
|
||||||
echo >&2 "$0: $1: Unknown compressed file name suffix"
|
printf '%s\n' "$0: $1: Unknown compressed file name suffix" >&2
|
||||||
exit 2;;
|
exit 2;;
|
||||||
esac
|
esac
|
||||||
case $1 in
|
case $1 in
|
||||||
|
@ -193,7 +193,7 @@ elif test $# -eq 2; then
|
||||||
esac;;
|
esac;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
echo >&2 "$0: Invalid number of operands; try \`${0##*/} --help' for help"
|
printf '%s\n' "$0: Invalid number of operands; try \`${0##*/} --help' for help" >&2
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,7 @@ while test $# -ne 0; do
|
||||||
(-[ef]* | --file | --file=* | --reg*)
|
(-[ef]* | --file | --file=* | --reg*)
|
||||||
have_pat=1;;
|
have_pat=1;;
|
||||||
(--h | --he | --hel | --help)
|
(--h | --he | --hel | --help)
|
||||||
echo "$usage" || exit 2
|
printf '%s\n' "$usage" || exit 2
|
||||||
exit;;
|
exit;;
|
||||||
(-H | --wi | --wit | --with | --with- | --with-f | --with-fi \
|
(-H | --wi | --wit | --with | --with- | --with-f | --with-fi \
|
||||||
| --with-fil | --with-file | --with-filen | --with-filena | --with-filenam \
|
| --with-fil | --with-file | --with-filen | --with-filena | --with-filenam \
|
||||||
|
@ -132,7 +132,7 @@ while test $# -ne 0; do
|
||||||
(-h | --no-f*)
|
(-h | --no-f*)
|
||||||
no_filename=1;;
|
no_filename=1;;
|
||||||
(-V | --v | --ve | --ver | --vers | --versi | --versio | --version)
|
(-V | --v | --ve | --ver | --vers | --versi | --versio | --version)
|
||||||
echo "$version" || exit 2
|
printf '%s\n' "$version" || exit 2
|
||||||
exit;;
|
exit;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,8 @@ Options are the same as for 'less'.
|
||||||
Report bugs to <@PACKAGE_BUGREPORT@>."
|
Report bugs to <@PACKAGE_BUGREPORT@>."
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
--help) echo "$usage" || exit 2; exit;;
|
--help) printf '%s\n' "$usage" || exit 2; exit;;
|
||||||
--version) echo "$version" || exit 2; exit;;
|
--version) printf '%s\n' "$version" || exit 2; exit;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if test "${LESSMETACHARS+set}" != set; then
|
if test "${LESSMETACHARS+set}" != set; then
|
||||||
|
|
|
@ -31,8 +31,8 @@ Like 'more', but operate on the uncompressed contents of xz compressed FILEs.
|
||||||
Report bugs to <@PACKAGE_BUGREPORT@>."
|
Report bugs to <@PACKAGE_BUGREPORT@>."
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
--help) echo "$usage" || exit 2; exit;;
|
--help) printf '%s\n' "$usage" || exit 2; exit;;
|
||||||
--version) echo "$version" || exit 2; exit;;
|
--version) printf '%s\n' "$version" || exit 2; exit;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
oldtty=`stty -g 2>/dev/null`
|
oldtty=`stty -g 2>/dev/null`
|
||||||
|
@ -50,7 +50,7 @@ fi
|
||||||
|
|
||||||
if test $# = 0; then
|
if test $# = 0; then
|
||||||
if test -t 0; then
|
if test -t 0; then
|
||||||
echo "$usage"; exit 1
|
printf '%s\n' "$usage"; exit 1
|
||||||
else
|
else
|
||||||
$xz -cdfq | eval "${PAGER:-more}"
|
$xz -cdfq | eval "${PAGER:-more}"
|
||||||
fi
|
fi
|
||||||
|
@ -69,7 +69,7 @@ else
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
if test "$ANS" != 's'; then
|
if test "$ANS" != 's'; then
|
||||||
echo "------> $FILE <------"
|
printf '%s\n' "------> $FILE <------"
|
||||||
$xz -cdfq -- "$FILE" | eval "${PAGER:-more}"
|
$xz -cdfq -- "$FILE" | eval "${PAGER:-more}"
|
||||||
fi
|
fi
|
||||||
if test -t 1; then
|
if test -t 1; then
|
||||||
|
|
Loading…
Reference in New Issue