diff options
author | EuAndreh <eu@euandre.org> | 2023-05-03 17:32:09 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2023-05-03 17:32:09 -0300 |
commit | 6a2e9fb7f37d2bc9f978d3a758fd0c8e33f05614 (patch) | |
tree | 140924170a5e804449b080accb1cff11c459f621 /bin | |
parent | bin/ifnew: Create tmpfile in the same directory to leverage "mv" in the same ... (diff) | |
download | dotfiles-6a2e9fb7f37d2bc9f978d3a758fd0c8e33f05614.tar.gz dotfiles-6a2e9fb7f37d2bc9f978d3a758fd0c8e33f05614.tar.xz |
bin/ifnew: Also add "-v" to "mv" and "rm" when -v is given
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/ifnew | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -96,12 +96,15 @@ trap 'rm -f "$STDIN"' EXIT cat - > "$STDIN" if ! cmp -s "$STDIN" "$FILE"; then + MV_ARGS='' if [ "$VERBOSE" = true ]; then printf 'ifnew: "%s" will be updated.\n' "$FILE" >&2 + MV_ARGS='-v' fi - mv "$STDIN" "$FILE" + mv $MV_ARGS "$STDIN" "$FILE" else if [ "$VERBOSE" = true ]; then printf 'ifnew: "%s" left unchanged.\n' "$FILE" >&2 + rm -vf "$STDIN" fi fi |