Use \grep .
The (Bourne/POSIX) shell specification says that alias substitution in an interactive shell is suppressed when any character of the command word is quoted.
Eu tenho um grep alias no meu .bash_profile que exibe números de linha e colore as correspondências. Este é um exemplo dos meus grep results:
$ grep test filename
1:This is a test (to be removed)
1:This is a second test (to be removed)
Este é meu alias:
alias grep="grep --color"
Existe alguma maneira de impedir o uso desse alias quando o comando grep é executado em um script?
Se eu tentei os seguintes comandos dentro do meu script:
grep test filename | sed -E 's/^(.*) \(.*$//g'
\grep test filename | sed -E 's/^(.*) \(.*$//g'
command grep test filename | sed -E 's/^(.*) \(.*$//g'
/usr/bin/grep test filename | sed -E 's/^(.*) \(.*$//g'
Tudo com os seguintes resultados:
1:This is a test
1:This is a second test
Será ótimo receber o seguinte resultado:
This is a test
This is a second test
Estou usando grep (GNU grep) 2.21 e GNU bash, version 4.3.33 .
Use \grep .
The (Bourne/POSIX) shell specification says that alias substitution in an interactive shell is suppressed when any character of the command word is quoted.