I am trying to set up an alias called "fire" that will allow me to pass an argument(s) along with the command.
#fire program1 restart
the fire alias should resolve to "/etc/rc.d/init.d/" and then stick the "program1" immediatly after the trailing slash so it appears as one command with one argument.
#/etc/rc.d/init.d/program1 restart
I would like to put this alias in my .cshrc file but can't get the alias working?
Perderabo gave a correct answer for what you asked and it does work....in csh. You wrote you wanted to add it to .cshrc.
If your account isn't using csh, then it may not work - please insure which shell you need the alias set up in as each could/would be different from csh.
*rofl* In your first post you didn't say which shell you were using, however you did mention putting the alias in .cshrc which is a standard startup file for csh. I therefore jumped to the conclusion that you are using csh or tcsh or some other csh clone. Putting bash aliases in .cshrc is rather unusual, but I guess you have customized your environment. Oh well, most people freak when they see my environment too...
bash has wimpy aliases and you can't constuct a bash alias to do this. You will need to use a function, like this:
fire() { /etc/rc.d/init.d/$* ; }
Most bash users would add that .bash_profile or .bash_rc or something like that. But, ummm, I'll leave it up to you where to install this.