LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 02-19-2005, 09:36 PM   #1
gflores
LQ Newbie
 
Registered: Dec 2004
Posts: 25

Rep: Reputation: 15
Alias question (2 commands for one alias)


I want to have something like this.

alias cdl='cd [directory] ; ls'

when this is entered:
cdl documents
it should be interpreted as this:
cd documents ; ls

I can't seem to make it like that. Any suggestions?
 
Old 02-19-2005, 10:25 PM   #2
DrOzz
Senior Member
 
Registered: May 2003
Location: Sydney, Nova Scotia, Canada
Distribution: slackware
Posts: 4,185

Rep: Reputation: 60
you'll have to do it something like this :
Code:
function chl(){
        cd $1 ; ls ;
}

alias chg='chl'
then type :
Code:
source .bashrc
to make it take effect, and then you could type something like :

Code:
chg Mail
and it will change to the Mail folder in this example and list the directory
contents ...
 
Old 02-19-2005, 10:43 PM   #3
gflores
LQ Newbie
 
Registered: Dec 2004
Posts: 25

Original Poster
Rep: Reputation: 15
Cool, that worked. Thanks for the fast reply!
 
Old 01-21-2006, 12:40 AM   #4
GosthMan
LQ Newbie
 
Registered: Dec 2005
Distribution: Debian Sarge,Ubuntu,RHE 5, Gentoo,CentOS 5
Posts: 24

Rep: Reputation: 15
10x for sharing
 
  


Reply



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
Another Newbie question....Alias tetpt Linux - Newbie 5 03-04-2005 10:58 AM
Alias commands in tcsh (Suse 9.0) m15a4 Linux - General 5 11-26-2003 03:46 PM
alias and export commands in modules.comf liguorir Linux - Software 1 06-26-2003 07:38 PM
Alias definition question Dark_Helmet Linux - General 5 02-04-2003 02:48 PM
alias question tied2 Linux - General 4 08-23-2002 10:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:21 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
Open Source Consulting | Domain Registration