On Mon, Dec 14, 2009 at 8:54 PM, Andrew Harley andrew@promed.com.au wrote:
It's not an issue with awk but with the way the alias is interpreted. It tries to run the result of the commands in between the ` ` as a command itself. To get around it, try:
# alias checketh0="echo `ifconfig eth0 | grep 'inet addr:' |awk '{print $2}' | cut -c 6-`"
Er, no, the double quotes will mean that the backtick command is expanded at the time the alias is defined rather than at the time it is run. So you'll get the ifconfig output from the time the shell started, always.
You want
alias checketh0 'echo `ifconfig eth0 | grep "inet addr:" |awk '''{print $2}''' | cut -c 6-`'