alias creation

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers alias creation
# 1  
Old 01-31-2002
alias creation

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?

# 2  
Old 01-31-2002
alias fire '/etc/rc.d/init.d/\!:*'
# 3  
Old 01-31-2002

Thanks for the reply; however, it still gives an error

bash: /etc/rc.d/init.d/!:*: No such file or directory

My alias declaration looks like this...

alias start='/etc/rc.d/init.d/\!:*'

I run it by this command...

# start app1 restart
# 4  
Old 01-31-2002
Perderabo gave a correct answer for what you asked and it does 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.

(You may also want to put what OS you are using.)
# 5  
Old 01-31-2002
*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.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

IP Alias

Quick question Have a AIX system that has been up for years with a 192.9.x.x IP scheme and we want to add a second IP to the system. I setup the second IP 10.1.x.x as an alias via smit. Since these two IP's are on different VLANs will this be an issue? Reason I ask is that I cannot ping... (3 Replies)
Discussion started by: Chrisp
3 Replies

2. UNIX for Dummies Questions & Answers

Create alias files (not alias commands)

If one: $ find -name 'some expression' -type f > newfile and then subsequently wants to create an alias file from each pathname the find command retrieved and the > placed within 'newfile', how would one do this? Ideally, the newly created alias files would all be in one directory. I am... (3 Replies)
Discussion started by: Alexander4444
3 Replies

3. UNIX for Dummies Questions & Answers


how to make alias perament? I have edited in .bashrc also but no use:(.How to manke it perament (3 Replies)
Discussion started by: kkalyan
3 Replies

4. UNIX for Dummies Questions & Answers


Hello. Q:Is it possible to create an alias for "nedit *. ". If it is how does it look like? Tks. (1 Reply)
Discussion started by: geko
1 Replies

5. Shell Programming and Scripting

please help me regarding alias

Dear All, I have given alias to run a script which will calculate memory and cpu utilization as "utils" in my bash shell. Even i have given this entry in .profile and .bashrc in my home directory. It is working fine. Now my question is that I want to use this alias in... (17 Replies)
Discussion started by: naree
17 Replies

6. UNIX for Dummies Questions & Answers

How to get the alias,when we have the IP.

Hi, I have to set up a printer in the system.Generally the alias is given like sdclbl1 etc.So when I ping i get the IP address. This time they have provided the IP adress.Is there any way to find the alias from this.Ping did not give the alias. Thanks and Regards, Gideon. (2 Replies)
Discussion started by: preethgideon
2 Replies

7. UNIX for Dummies Questions & Answers

alias help

Hi I have a problem when i try to set any thing as alias it works say alias sasa="cd /home/hghgg" but when i close the terminal it does not work (5 Replies)
Discussion started by: shafique
5 Replies

8. Shell Programming and Scripting


how implement functionality alias in the same way as in csh? (use Bourne type sh or bash) (3 Replies)
Discussion started by: sunhata
3 Replies

9. UNIX for Dummies Questions & Answers


Hello, I'm a beginner to Unix and I want to create an alias that lists the given directory in long format; the alias should use a pager to display the result. Thanks in advance. (2 Replies)
Discussion started by: guelpth
2 Replies
Login or Register to Ask a Question