-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new feature to base.plugin.bash #2257
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -183,3 +183,16 @@ if ! _command_exists del; then | |
mkdir -p /tmp/.trash && mv "$@" /tmp/.trash | ||
} | ||
fi | ||
|
||
# replace multiple file extensions at once | ||
function rex() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is already a package in Ubuntu and other distros called rex and I would rather not have them clash. Could you consider naming it renex or rext? |
||
about 'mass replace of the extension of multiple files' | ||
param '1: extension to replace' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The indentation is mixed spaces and tabs, please align all to just tabs. Thanks! |
||
param '2: new extenstion' | ||
example 'rex txt md' | ||
group 'base' | ||
local ext2replace="${1:-}" | ||
local newext="${2:-}" | ||
local files=(`ls *.$ext2replace`) | ||
for file in "${files[@]}"; do mv "$file" "${file/%.$ext2replace/.$newext}"; done | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit too short and already taken by a function for the fasd plugin. please rename to something that won't clobber or move to your private alias file.