The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Alias Help NetJones UNIX for Dummies Questions & Answers 1 03-16-2008 06:47 AM
How to get the alias,when we have the IP. preethgideon UNIX for Dummies Questions & Answers 2 07-24-2007 02:53 PM
alias klannon Filesystems, Disks and Memory 6 04-27-2006 08:36 AM
Alias sunhata Shell Programming and Scripting 3 01-29-2006 07:03 AM
alias sskb UNIX for Dummies Questions & Answers 2 12-17-2001 12:53 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-31-2002
randyreese randyreese is offline
Registered User
  
 

Join Date: Jan 2002
Location: Buffalo, NY
Posts: 2
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?

Thanks.
  #2 (permalink)  
Old 01-31-2002
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
Try:
alias fire '/etc/rc.d/init.d/\!:*'
  #3 (permalink)  
Old 01-31-2002
randyreese randyreese is offline
Registered User
  
 

Join Date: Jan 2002
Location: Buffalo, NY
Posts: 2
Thumbs down

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 (permalink)  
Old 01-31-2002
thehoghunter
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
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.

(You may also want to put what OS you are using.)
  #5 (permalink)  
Old 01-31-2002
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
*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.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:42 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0