From 30fc3fe799a9ab075c8e9bba72c5248a402c25b3 Mon Sep 17 00:00:00 2001 From: Paul <140338790+TheMadTomato@users.noreply.github.com> Date: Wed, 3 Jul 2024 19:41:11 +0300 Subject: [PATCH 1/2] Update general.aliases.bash 2 New aliases: d: go to Downloads directory from anywhere rmrf: force delete any file or directory recursively --- aliases/available/general.aliases.bash | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/aliases/available/general.aliases.bash b/aliases/available/general.aliases.bash index 2511aab8a9..5ed1576227 100644 --- a/aliases/available/general.aliases.bash +++ b/aliases/available/general.aliases.bash @@ -20,6 +20,7 @@ alias _='sudo' alias vbrc='${VISUAL:-vim} ~/.bashrc' alias vbpf='${VISUAL:-vim} ~/.bash_profile' + # colored grep # Need to check an existing file for a pattern that will be found to ensure # that the check works when on an OS that supports the color option @@ -55,6 +56,7 @@ alias cd..='cd ..' # Common misspelling for going up one directory alias ...='cd ../..' # Go up two directories alias ....='cd ../../..' # Go up three directories alias -- -='cd -' # Go back +alias d='cd /home/$USER/Downloads' # Go to the Downloads directory # Shell History alias h='history' @@ -68,6 +70,9 @@ fi alias md='mkdir -p' alias rd='rmdir' +# Remove +alias rmrf='rm -rf' + # Shorten extract alias xt='extract' From cf72967bd7ec39de8965118ce4d56c09520339bc Mon Sep 17 00:00:00 2001 From: Paul <140338790+TheMadTomato@users.noreply.github.com> Date: Wed, 3 Jul 2024 20:51:42 +0300 Subject: [PATCH 2/2] Added new feature to base.plugin.bash New function labeled `rex()` servers a single purpose. Replace the file extensions of multiple file at once. File extensions usually does not quite matter in bash, but there is a few cases when one might needs to and this function simplifies the process from multiple commands into one. --- plugins/available/base.plugin.bash | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plugins/available/base.plugin.bash b/plugins/available/base.plugin.bash index 1a905163e4..8e3c2d1227 100644 --- a/plugins/available/base.plugin.bash +++ b/plugins/available/base.plugin.bash @@ -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() { + about 'mass replace of the extension of multiple files' + param '1: extension to replace' + 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 +}