Created
March 4, 2025 06:15
-
-
Save notpushkin/0379568fa3736adc59e6ed227a0cbcdc to your computer and use it in GitHub Desktop.
A shell function that wraps rm and re-orders flags in a way compatible with BSD platforms.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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