Solved Help with aliases

I want to set up an alias in .cshrc to do something like

png 'x' ping -c3 192.168.1.'x'

where 'x can be any number, so that entering png 3 will run ping -c3 192.168.1.3.

Is this doable?
 
I don't know how to do that in alias but i guess you can try function. This works in bash but i am not sure if this can work for csh too.

png() {
ping -c${1} 192.168.1.${1}
}
 
alias png ping -c\!^ 192.168.1.\!$
png 1 # ping -c1 192.168.1.1
png 1 2 # ping -c1 192.168.1.2
Excellent! I wouldn't have been able to work that out for myself, although I wanted -c3 so I've added

alias png ping -c3 192.168.1.\!$

to my ~/.cshrc
 
Back
Top