Solved

aliases

Posted on 1998-09-17
3
163 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

691 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