convert echo to printf
This commit is contained in:
parent
00bbd5623c
commit
547cea05e1
8
doasedit
8
doasedit
@ -1,12 +1,12 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
if [ -n "${2}" ]; then
|
if [ -n "${2}" ]; then
|
||||||
echo "Expected only one argument"
|
printf 'Expected only one argument\n'
|
||||||
exit 1
|
exit 1
|
||||||
elif [ -z "${1}" ]; then
|
elif [ -z "${1}" ]; then
|
||||||
echo "No file path provided"
|
printf 'No file path provided\n'
|
||||||
exit 1
|
exit 1
|
||||||
elif [ "$(id -u)" -eq 0 ]; then
|
elif [ "$(id -u)" -eq 0 ]; then
|
||||||
echo "Cannot be run as root"
|
printf 'Cannot be run as root\n'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ $EDITOR "$tempdir"/edit
|
|||||||
doas tee "$tempdir"/file 1>/dev/null < "$tempdir"/edit
|
doas tee "$tempdir"/file 1>/dev/null < "$tempdir"/edit
|
||||||
|
|
||||||
if doas cmp -s "$tempdir/file" "$srcfile"; then
|
if doas cmp -s "$tempdir/file" "$srcfile"; then
|
||||||
echo "Skipping write; no changes."
|
printf 'Skipping write; no changes.\n'
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
doas mv -f "$tempdir"/file "$srcfile"
|
doas mv -f "$tempdir"/file "$srcfile"
|
||||||
|
Loading…
Reference in New Issue
Block a user