<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
On 15/12/09 15:40, Majian wrote:
<blockquote
cite="mid:eb686fc70912142040l4fe7c660w1534c160d92506b1@mail.gmail.com"
type="cite">Hi ,all :<br>
<br>
I'm trying to define an alias with an embeded awk command:<br>
<br>
alias checketh0 `ifconfig eth0 |grep 'inet addr:' |awk '{prinrt $2}'
|cut -c 6- `<br>
<br>
After I edit it in the .cshrc file and run "source .cshrc" , I run
the "checketh0" command in the terminal ,<br>
the screen displays the "<a moz-do-not-send="true"
href="http://192.168.7.24">192.168.7.24</a>: Command not found "<br>
<br>
<br>
Why does is it ?Any help will be highly appreciated.<br>
<br>
note: I'm using csh shell.<br>
</blockquote>
Hi Majian,<br>
<br>
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: <br>
<br>
# alias checketh0="echo `ifconfig eth0 | grep 'inet addr:' |awk '{print
$2}' | cut -c 6-`"<br>
<br>
Cheers,<br>
<br>
Andrew<br>
</body>
</html>