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

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

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

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 :" '

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.

:slight_smile:

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.

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