LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 05-31-2004, 02:36 AM   #1
chii-chan
Member
 
Registered: Sep 2003
Location: chikyuu (E103N6)
Distribution: Redhat 8.0 (2.4.25-custom), Fedora Core 1 (2.4.30-custom)
Posts: 357

Rep: Reputation: 30
alias two words or more


Hi. I think this question is kind of stupid. Usually when you set alias in your ~/.bashrc file, you make it consist of one word like this:

alias rm='rm -i'

But what if I want to make the alias to consist of two words or more. I've tried this:

alias remove\ junks='rm -i'
alias "remove junks"='rm -i'
alias 'remove junks'='rm -i'

And I want space between the words so that when I type something like:

Code:
remove junks junk.file
, it would do
Code:
rm -i junk.file
for me. Or there limitation for alias command? Thanks.
 
Old 05-31-2004, 02:46 AM   #2
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
I'm not an alias expert but feel that wouldn't work out so well.. why not just write a basic shell script to do this, with options, etc?
 
Old 05-31-2004, 02:48 AM   #3
micxz
Senior Member
 
Registered: Oct 2002
Location: CA
Distribution: openSuSE, Cent OS, Slackware
Posts: 1,131

Rep: Reputation: 75
rm is short for remove so your theory of making a two word alias does not make much sense to me. In fact you unaliasing in this case. And yes I beleive the built in command for alias does not accept two arguments:
alias [-p] [name[=value] ...]
 
Old 05-31-2004, 02:49 AM   #4
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
Quote:
Originally posted by micxz
rm is short for remove so your theory of making a two word alias does not make much sense to me. In fact you unaliasing in this case. And yes I beleive the built in command for alias does not accept two arguments:
alias [-p] [name[=value] ...]
Also I would think typing rm -i junk.file would be easier to type than remove junks junk.file as well..
 
Old 05-31-2004, 02:54 AM   #5
micxz
Senior Member
 
Registered: Oct 2002
Location: CA
Distribution: openSuSE, Cent OS, Slackware
Posts: 1,131

Rep: Reputation: 75
You could use `remove_junk` then hopefully when you type "rem"+TAB you should get what you want. Pretty silly if you ask me. But you may have some other function for this in mind'
 
Old 05-31-2004, 03:00 AM   #6
chii-chan
Member
 
Registered: Sep 2003
Location: chikyuu (E103N6)
Distribution: Redhat 8.0 (2.4.25-custom), Fedora Core 1 (2.4.30-custom)
Posts: 357

Original Poster
Rep: Reputation: 30
Yeah! Just to make the command line to understand normal words. Even when I make a script 'remove junk', I cannot run it unless I put the '\' in between. I think I should make a script that accept command from echo -n instead. Thanks guy.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Alias question (2 commands for one alias) gflores Linux - Newbie 3 01-21-2006 01:40 AM
Words traner lutifer Linux - Software 1 09-29-2005 12:59 PM
Words you've never used acid_kewpie General 26 12-23-2004 04:21 AM
Search and Replace: Asian Words to English Words ieeestd802 Linux - Software 0 10-27-2004 08:48 PM
there aren't any words... salparadise General 8 01-09-2004 05:05 AM


All times are GMT -5. The time now is 12:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration