Solved

aliases

Posted on 1998-09-17
3
160 Views
Last Modified: 2010-04-21
How do I create an alias in my .cshrc file? I am trying to create the following alias:
alias nc "niscat hosts | grep something | awk '{print $1}'"

When I type "alias" at the prompt I see:
nc    niscat hosts | grep something | awk '{print }'

When type at the command prompt it works fine, but inside a
script file like .cshrc, the $1 is translated as a NULL variable since no parameters were passed to .cshrc. I am unsure how to use $1 inside a script for awk's print statement.
0
Comment
Question by:carydb
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
junfeb earned 50 total points
ID: 2007018
Why don't you try this as the cshrc prompt -
alias nc "niscat hosts| grep something | awk '{print "\$1"}'"

This produces alias to be  
niscat hosts| grep something | awk '{print $1}'

Thanks.
0
 
LVL 3

Expert Comment

by:junfeb
ID: 2007019
P.S. It works fine in the .cshrc file as well .
0
 

Author Comment

by:carydb
ID: 2007020
Thanks junfeb! Your suggestion works fine. I guess you can tell I kinda new to unix.:)
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question