?
Solved

aliases

Posted on 1998-09-17
3
Medium Priority
?
165 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 200 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
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…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

800 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