Skip to content

Instantly share code, notes, and snippets.

@notpushkin
Created March 4, 2025 06:15
A shell function that wraps rm and re-orders flags in a way compatible with BSD platforms.
# SPDX-License-Identifier: Unlicense
rm() {
local flags=()
local args=()
for arg in "$@"; do
if [[ $arg == -* ]]; then
flags+=("$arg")
else
args+=("$arg")
fi
done
command rm "${flags[@]}" "${args[@]}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment