Пакетное объединение mkv-видео с субтитрами с помощью MKVToolNix

Чтобы ответить на вопрос заголовка, попробуйте!$:

$ export EDITOR="emacs -nw"
$ echo !$
EDITOR=emacs -nw

Это расширение истории. Из справочной страницы bash:

History expansion is performed immediately after a complete line is read, before the shell breaks it into words. It takes place in two parts. The first is to determine which line from the history list to use during substitution. The second is to select portions of that line for inclusion into the current one. The line selected from the history is the event, and the portions of that line that are acted upon are words.

...

Event Designators

...

! Start a history substitution, except when followed by a blank, newline, carriage return, = or ( (when the extglob shell option is enabled using the shopt builtin).

...

!! Refer to the previous command. This is a synonym for `!-1'.

...

Word Designators

...

$ The last word. This is usually the last argument, but will expand to the zeroth word if there is only one word in the line.

...

If a word designator is supplied without an event specification, the previous command is used as the event.

0
21.02.2020, 03:25
1 ответ

Если каждому XYZ.mkvсоответствует XYZ.ass, можно использовать цикл for:

for i in *.mkv; do
    if [ -f "${i%.*}".ass ] && [ ! -e "${i%.*}"-sub.mkv ]; then
        mkvmerge -o "${i%.*}"-sub.mkv "$i" --default-track 0 --language 0:es "${i%.*}".ass
    fi
done
  • Примечание. :Я изменил порядок входных файлов, чтобы дорожка assдобавлялась после дорожек изmkv
2
28.04.2021, 23:22

Теги

Похожие вопросы