Skip to content

Instantly share code, notes, and snippets.

@openglfreak
Created August 1, 2021 22:38
Show Gist options
  • Save openglfreak/14b505758b05a7cb7112265f77c17954 to your computer and use it in GitHub Desktop.
Save openglfreak/14b505758b05a7cb7112265f77c17954 to your computer and use it in GitHub Desktop.
w_try_mv()
{
mv_src="${*: -2:1}"
mv_dst="${*: -1:1}"
if [ "${mv_src^^}" != "${mv_dst^^}" ]; then
w_try mv "$@"
return
fi
w_try mv "${@: -$#:$#-2}" "$mv_src" "${mv_src}_"
w_try mv "${@: -$#:$#-2}" "${mv_src}_" "${mv_dst}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment