Как скопировать диск с нечитаемыми секторами?

IIUC, вы можете соединить строки с ||, если mongoвозвращает не -ноль при ошибке. Как описано вman bash:

An OR list has the form

           command1 || command2

   command2 is executed if and only if command1 returns a non-zero exit status.  The return status of AND and OR lists is the exit status of the last command executed in the list.

У меня нет mongoздесь, но я могу выложить примерsucceeds.sh:

#!/usr/bin/env sh
nonexistent-command || \
echo a || \
echo b || \
echo c    

Выполнить:

$./succeeds.sh
./succedds.sh: line 3: nonexistent-command: command not found
a

Как видите, скрипт останавливается на a, потому что это первая команда, которая завершилась успешно.

0
11.03.2020, 01:26
0 ответов

Теги

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