convert echo to printf

This commit is contained in:
Joel Beckmeyer 2021-12-01 13:44:52 -05:00
parent 00bbd5623c
commit 547cea05e1
1 changed files with 4 additions and 4 deletions

View File

@ -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"