के लिए मेरा डिफ़ॉल्ट विकल्प सेट करने के grep(से MSYS Win7 में) वस्तु फ़ाइलों और विशिष्ट dirs अनदेखी करने के लिए, मैं निर्यात
GREP_OPTIONSकरने के लिए ~/.profileइस प्रकार है:
export GREP_OPTIONS='--exclude=*.{o,obj,pyc} --exclude-dir={.git,_Output}'
export GREP_COLOR='1;32'
मेरे .profileप्रभावी होने के लिए शेल को पुनरारंभ करने के बाद भी , मेरी कॉल grepअभी भी ऑब्जेक्ट फ़ाइलों को खोजती है। हालाँकि, GREP_COLORचर काम करने लगता है। मैंने भी निष्पादित करने से पहले एक ही शेल में स्पष्ट रूप से अपने विकल्प सेट करने की कोशिश की grep:
$ grep --version
GNU grep 2.5.4
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ export GREP_OPTIONS='--exclude=*.{o,obj,pyc} --exclude-dir={.git,_Output}'
$ echo $GREP_OPTIONS
--exclude=*.{o,obj,pyc} --exclude-dir={.git,_Output}
$ grep $GREP_OPTIONS -r foo .
grep: ./bar.o: Permission denied
./baz.c:My foo text
$ grep --exclude=*.{o,obj,pyc} --exclude-dir={.git,_Output} -r foo .
./baz.c:My foo text
मैं कैसे मिलता है grepस्वचालित रूप से उपयोग करने के लिए GREP_OPTIONSसे ~/.profile?