Если вы хотите "параллельно", используйтеparallel
shopt -s extglob
parallel sh -c 'out="${1%.txt}_new.txt"; head -n 100 "$1" > "$out"' _ -- !(*_new).txt
Я предполагаю, что у вас оболочка bash, и вы используете расширенные шаблоны для перебора текстовых файлов, которые не не *_new.txt
См.info zsh format
(вам может потребоваться установить пакет zsh-doc
или его аналог ).
Вы можете установитьformat
zstyle
для завершения:
zstyle ':completion:*' format '%K{blue}%F{yellow}Completing %d:%k%f'
Заголовки завершения будут отображаться как что-то вроде Completing recent branches:
желтым цветом на синем фоне.
Вы найдете его в меню compinstall
в разделе :
3. Styles for changing the way completions are displayed and inserted.
[...]
1. Change appearance of completion lists: allows descriptions of
completions to appear and sorting of different types of completions.
[...]
1. Print a message above completion lists describing what is being
completed.
[...]
You can set a string which is displayed on a line above the list of matches
for completions. A `%d' in this string will be replaced by a brief
description of the type of completion. For example, if you set the
string to `Completing %d', and type ^D to show a list of files, the line
`Completing files' will appear above that list. Enter an empty line to
turn this feature off. If you enter something which doesn't include `%d',
then `%d' will be appended. Quotation will be added automatically.
description>
Вы обнаружите, что compinstall
устанавливает стиль как zstyle ':completion:*' format
. Это устанавливает формат для всех видов дополнений (файлов, каталогов, фильтров... ). Вы также можете установить разные стили для разных категорий (, см. первый аргумент, переданный в _description
в grep -rw _descriptions $fpath
):
zstyle ':completion:*:*director*' format '%F{blue}%BCompleting %d:%b%f'
zstyle ':completion:*:*file*' format '%F{magenta}%BCompleting %d:%b%f'
# fallback:
zstyle ':completion:*:descriptions' format '%BCompleting %d:%b'
Хотя вы обнаружите, что теги (files
, directories
... )не всегда последовательно используются всеми завершителями.
Я нашел решение в https://github.com/solnic/dotfiles/blob/master/home/zsh/completion.zsh.
Соответствующий отрывок
// needs 'autoload -U colors && colors'
zstyle ':completion:*:descriptions' format "%{${fg_bold[magenta]}%}= %d =%{$reset_color%}"