I would like to create an alias for | grep
eg, for example be able to write:
ps -axf G chrome instead of ps -axf | grep chrome
This question was already asked on stackoverflow, however in the context of other shells, like zsh. Proposed solutions like
alias -g G=' | grep -i '
do not work with fish.
Error message for example given above:
- (line 1): Missing end to balance this function definition
function G --wraps ' | grep --color' --description 'alias G= | grep --color'; | grep --color $argv; end
^
from sourcing file -
called on line 70 of file /usr/local/Cellar/fish/3.5.1/share/fish/functions/alias.fish
in function 'alias' with arguments 'G=\ \|\ grep\ --color'
called on line 6 of file ~/.config/fish/config.fish
from sourcing file ~/.config/fish/config.fish
called during startup
and for
alias -g G=' \| grep -i '
it results in error cat: G: No such file or directory (by running cat file G "chrome")