cd alias
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Shell > cd alias




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    cd alias  
Michael Tosch


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-19-06 11:24 PM

Hi,

in csh/tcsh I have an alias

alias cd 'cd \!*; echo $cwd'

and I would like to have this in bash-2.

The man page says I cannot refer to arguments in an alias,
I need a function.
In a function I can refer to it as "$@", but

cd(){
\cd "$@"
echo $PWD
}

continuesly calls itself, because the escape \cd
does not work for a function (only works for an alias).

Suggestions?


--
Michael Tosch @ hp : com





[ Post a follow-up to this message ]



    Re: cd alias  
Stephane Chazelas


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-19-06 11:24 PM

On Thu, 19 Jan 2006 15:28:00 +0100, Michael Tosch wrote:
> Hi,
>
> in csh/tcsh I have an alias
>
> alias cd 'cd \!*; echo $cwd'
>
> and I would like to have this in bash-2.

cd() {
builtin cd "$@"
pwd
}

--
Stephane





[ Post a follow-up to this message ]



    Re: cd alias  
Michael Tosch


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-19-06 11:24 PM

Stephane Chazelas wrote:
> On Thu, 19 Jan 2006 15:28:00 +0100, Michael Tosch wrote:
> 
>
>
> cd() {
>   builtin cd "$@"
>   pwd
> }
>

Thanks!

--
Michael Tosch @ hp : com





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 06:13 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register