Thanks for your advice ~ But After I edit the command "alias checketh0 "echo `ifconfig eth0 | grep 'inet addr:' |awk '{print $2}' | cut -c 6-`" in my .cshrc file The screen displays this : innet addr:192.168.7.24 Bcast:192.168.7.255 Mask :255.255.255.0 I just want to the "192.168.7.24" Maybe is it the awk command error? On Tue, Dec 15, 2009 at 12:54 PM, Andrew Harley <andrew at promed.com.au>wrote: > On 15/12/09 15:40, Majian wrote: > > Hi ,all : > > I'm trying to define an alias with an embeded awk command: > > alias checketh0 `ifconfig eth0 |grep 'inet addr:' |awk '{prinrt $2}' |cut > -c 6- ` > > After I edit it in the .cshrc file and run "source .cshrc" , I run the > "checketh0" command in the terminal , > the screen displays the "192.168.7.24: Command not found " > > > Why does is it ?Any help will be highly appreciated. > > note: I'm using csh shell. > > Hi Majian, > > 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-`" > > Cheers, > > Andrew > > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.centos.org/pipermail/centos/attachments/20091215/887f5d36/attachment-0005.html>