флаг grep, чтобы НЕ игнорировать регистр

Похоже ./configureне может найти архиватор arв пути.

Таким образом, мы можем добавить его, используя:

export PATH=/usr/ccs/bin:/usr/sbin:/usr/bin:/usr/sfw/bin:/usr/sfw/sbin:$PATH
1
28.01.2021, 21:55
1 ответ

Новые версии grepимеют опцию --no-ignore-case, которая переопределяет-i:

--no-ignore-case
Do not ignore case distinctions in patterns and input data. This is the default. This option is useful for passing to shell scripts that already use -i, to cancel its effects because the two options override each other.

Для более старых версий grepвы можете просто добавить этот параметр в свой скрипт:

#!/usr/bin/bash
if [ "$1" = "--no-ignore-case" ]; then
    shift
    grep -rnI --exclude-dir={.git,obj} --exclude=tags --color=auto "$@"
else
    grep -irnI --exclude-dir={.git,obj} --exclude=tags --color=auto "$@"
fi

Примечание.:--no-ignore-caseдолжен быть первым аргументом при вызове скрипта.

3
18.03.2021, 22:34

Теги

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