From 7a7b6c2b2aca1eea238cd9f31b0c93b0a6124ac0 Mon Sep 17 00:00:00 2001 From: Maxim Likhachev Date: Mon, 28 Mar 2016 10:49:03 +0500 Subject: [PATCH] bash: aliases: ++apply --- etc/shell/bash/aliases | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/etc/shell/bash/aliases b/etc/shell/bash/aliases index fee58bc..86e7e90 100755 --- a/etc/shell/bash/aliases +++ b/etc/shell/bash/aliases @@ -334,6 +334,23 @@ wcu() { cat "$1" | tr -cs A-Za-z\' '\n' | tr A-Z a-z | sort | uniq -c | sort -nr | nl } +#- Выполнение команды для всех файлов: apply cmd -1 -2 @ *.file +apply() { + CMD="" + + for argument in $@; { + if [ "$argument" != "@" ]; then + CMD+=" $argument"; shift + else + shift; break + fi + } + + for file in $@; { + eval "$CMD" "$file" + } +} + #}}} ########################################################################### #{{{ \033[00m\n\b------<Администрирование>\n ################################################################################