The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Special Forums > Filesystems, Disks and Memory
Google UNIX.COM


Filesystems, Disks and Memory Questions involving NAS, SAN, RAID, Robotic Libraries, backups, etc go here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
please help me regarding alias naree Shell Programming and Scripting 17 06-03-2008 01:14 AM
How to get the alias,when we have the IP. preethgideon UNIX for Dummies Questions & Answers 2 07-24-2007 11:53 AM
alias help shafique UNIX for Dummies Questions & Answers 5 10-03-2006 09:56 AM
using alias... DebianJ UNIX for Advanced & Expert Users 2 05-12-2005 06:31 PM
Alias guelpth UNIX for Dummies Questions & Answers 2 02-17-2005 04:29 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 05-06-2002
Registered User
 

Join Date: Mar 2002
Location: MA
Posts: 9
alias

Hello,

I'm trying to create an alias that will show the path name of a current directory when a user cd's into any directory.

I have tried the following:

alias cd ' cd | pwd '

This just lists the current directory, even when I cd to another directory the alias just lists my home working directory.


Thanks
Reply With Quote
Forum Sponsor
  #2  
Old 05-06-2002
thehoghunter
Guest
 

Posts: n/a
You are setting the alias cd to only cd back to your home directory...you aren't giving it the parameter of where to change to.

Try this instead - (will work with ksh and sh - not csh)
set up PS1=`$PWD` in your .profile
Reply With Quote
  #3  
Old 05-06-2002
Registered User
 

Join Date: Mar 2002
Location: MA
Posts: 9
thehoghunter:

Are you saying that I cannot create an alias within the csh to allow the user to know the cwd upon cd'ing?

thanks
Reply With Quote
  #4  
Old 05-06-2002
thehoghunter
Guest
 

Posts: n/a
No, I wrote that the information given would not work with csh. If you know csh, you know it doesn't use .profile .

Put the following (or something like it) in your .cshrc
alias cd 'cd \!*;set prompt="[`hostname`]$cwd :" '

Last edited by thehoghunter; 05-06-2002 at 10:41 AM.
Reply With Quote
  #5  
Old 05-06-2002
Registered User
 

Join Date: Jul 2001
Location: California
Posts: 42
csh ....

try use those lines on your .cshrc

set prompt = "[\!]$USER@`hostname`>"
alias setprompt 'set prompt = "$USER@`hostname` $cwd>"'
setprompt
alias cd 'cd \!*;setprompt'
alias pushd 'pushd \!*; setprompt'
alias popd 'popd \!*; setprompt'
alias pwd 'echo $cwd'

Hope this help.

__________________
:rolleyes:
Reply With Quote
  #6  
Old 05-06-2002
Registered User
 

Join Date: Mar 2002
Location: MA
Posts: 9
Lightbulb alias

yellowfish, thehoghunter:

Thanks for the advice, I will give it a shot. I found another way of performing this task:

alias cd 'get old = $ cwd; chdir \ !*; pwd'

This works just fine.

Again, thanks.
Reply With Quote
  #7  
Old 04-27-2006
Registered User
 

Join Date: Apr 2006
Posts: 34
Hi,

I'm using ksh do you know how to make an alias for cd that will list all the files in the current directory?

Cheers

C19
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 06:09 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0