Re: [Fish-users] Wildcards and ranges, am I missing something?
Status: Beta
Brought to you by:
liljencrantz
|
From: Myrddin E. <my...@gm...> - 2026-10-03 16:04:16
|
I'm no expert in fish, even though it's my standard shell, but this feels
like something you could customize with an alias.
function rmr
if test (count $argv) -eq 0
echo "Usage: rmr <regex-pattern> [rm-flags]"
echo "Example: rmr '^[a-c].*' # removes files starting with a, b,
or c"
return 1
end
rm $argv[2..-1] (string match -r $argv[1] *)
end
Perhaps someone smarter than me could do it without requiring single quotes
around the regex. You could probably also make some equivalent `rmg`
variant by inserting some hellish Perl one-liner that converts glob syntax
into regex.
|