LinuxQuestions.org
Help answer threads with 0 replies.
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 01-11-2005, 09:59 AM   #1
Cubert
LQ Newbie
 
Registered: Jan 2005
Posts: 2

Rep: Reputation: 0
Creating an alias (name=value pair) where the name has spaces.


Hi,

Can an alias (in the .bashrc file) has one or more spaces in the name part of the name=value pair?

For example,

alias ls -l="ls -lh"

If yes, how?

Thanks and regards.
 
Old 01-11-2005, 10:13 AM   #2
zeropash
Member
 
Registered: Apr 2003
Location: Bangalore,India
Distribution: FC2, RHES, RH9, FC3, FC1, Slackware 3.0
Posts: 208

Rep: Reputation: 30
I dont think what you asked can be done
however for what you intend in the example you can do a
alias ls=`ls -h`
ls -l would now be equal to ls -lh

another way of doing things is functions for example
for ex
unalias ls
function ls() {
if [ "$#" -gt 0 -a "$1" = "-l" ]; then
/bin/ls -h $*
else
/bin/ls $*
fi
}
or something like that

Last edited by zeropash; 01-11-2005 at 10:23 AM.
 
Old 01-12-2005, 07:42 AM   #3
Cubert
LQ Newbie
 
Registered: Jan 2005
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks zeropash.
 
  


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
Need advice on creating an alias thorney Linux - General 2 11-27-2005 08:33 PM
Apache - creating an alias to access a cd-rom or DVD. verlossen Linux - Software 2 11-23-2005 07:14 AM
Lost pane,issues when creating alias from the bash shell spoult Linux - Software 2 04-19-2005 07:22 AM
Creating mult command alias in BASH labob Linux - Newbie 1 11-18-2004 08:37 PM
problem creating an alias to mount a drive j_l_ajaste Linux - Newbie 6 07-01-2003 11:41 PM


All times are GMT -5. The time now is 01:25 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration