I'd like to create a simple alias:
alias gate=route | grep default | awk '{print $2}'
and even though the command does work in terminal, it's not working through ~/.bash_aliases. Thanks.
I'd like to create a simple alias:
alias gate=route | grep default | awk '{print $2}'
and even though the command does work in terminal, it's not working through ~/.bash_aliases. Thanks.
You need to put quotes around the pipeline - being careful to ensure that
$2
doesn't get expanded by the shell. So for exampleor
Note that
awk
can do pattern matching - so you don't really needgrep
: