Operating System - HP-UX
1760992 Members
12210 Online
108896 Solutions
New Discussion юеВ

Re: Problem assigning a command alias

 
Jeff Carlin
Frequent Advisor

Problem assigning a command alias

I am tring to make and alias called "dfp" for the following command:

df | awk '{printf("%-25s %4s %-20s \n",$1,$4,$7);}'

If I try:
alias dfp=df | awk '{printf("%-25s %4s %-20s \n",$1,$4,$7);}'

it takes it, but when I type dfp, I get an error in the awk part:
"Usage: awk [-F Character][-v Variable=Value][-f File|Commands][Variable=Value|File ...]"

I've tried other variations of quoting and receive errors with each attemp. Any of you Guru's want to take a stab at this?
Where wisdom is called for, force is of little use. --Of course, a hammer does wonders for relieving stress.
3 REPLIES 3
IT_2007
Honored Contributor

Re: Problem assigning a command alias

you forgot single tick for entire command.

It should be like this:

alias dfp='df | awk '{printf("%-25s %4s %-20s \n",$1,$4,$7);}''
Jeff Carlin
Frequent Advisor

Re: Problem assigning a command alias

Disregard this post.
Where wisdom is called for, force is of little use. --Of course, a hammer does wonders for relieving stress.
Jeff Carlin
Frequent Advisor

Re: Problem assigning a command alias

@IT_2007

I'm such a bonehead! I'm running dsh, a distributed shell where I can run commands across many systems at once.

I thought I was on all HP servers, but one was AIX. The command was, of course, not running on the AIX server.

Sorry!
Where wisdom is called for, force is of little use. --Of course, a hammer does wonders for relieving stress.