Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 01-11-2005, 08:59 AM   #1
LQ Newbie
Registered: Jan 2005
Posts: 2

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


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, 09:13 AM   #2
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 $*
/bin/ls $*
or something like that

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

Original Poster
Rep: Reputation: 0
Thanks zeropash.


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

All times are GMT -5. The time now is 09:34 PM.

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