[ale] cd in bash or ksh, how to do this

Jim Kinney jim.kinney at gmail.com
Wed Sep 22 13:07:34 EDT 2010


shell function version will occur first choice by default. To force a system
function instead, give full path to the binary location in the filesystem.

On Wed, Sep 22, 2010 at 12:25 PM, Narahari 'n' Savitha
<savithari at gmail.com>wrote:

> Thank you. It is what I was looking for.
>
> How do you tell the shell use the cd function instead of the inbuild cd.
>
> -Narahari
>
> On Mon, Sep 20, 2010 at 5:00 PM, Don Lachlan <ale-at-ale.org@
> unpopularminds.org> wrote:
>
>> On Fri, Sep 17, 2010 at 5:44 PM, Narahari 'n' Savitha
>> <savithari at gmail.com> wrote:
>> > I remember using cd in the following way.
>> >
>> > $pwd
>> > /this/is/the/folder/that/all/are/in/now
>> >
>> > The folder structure till the that is
>> > $ls /this/is/the/folder/that/
>> >
>> > all
>> > males
>> > females
>> >
>> > I was able to do this
>> >
>> > $cd all males
>> > $pwd
>> > /this/is/the/folder/that/males/are/in/now
>> > $cd males females
>> > /this/is/the/folder/that/females/are/in/now
>>
>> If you're trying string replacement in bash:
>>
>> bash$ cd /usr/lib
>> bash$ pwd
>> /usr/lib
>> bash$!?cd?:s/usr/var/
>> bash$ pwd
>> /var/lib
>>
>> I don't know of a 'cd' specific one to do that, but it's simple to
>> write a bash function:
>>
>> function cd () {
>>  if [ -n "$2" ] ; then
>>    nd=`pwd | sed 's/'$1'/'$2'/'`
>>    builtin  cd $nd
>>  else
>>    builtin cd $1
>>  fi
>> }
>>
>> bash$ cd /usr/lib/
>> bash$ pwd
>> /usr/lib
>> bash$ cd usr var
>> bash$ pwd
>> /var/lib
>>
>> -Lachlan
>>  _______________________________________________
>> Ale mailing list
>> Ale at ale.org
>> http://mail.ale.org/mailman/listinfo/ale
>> See JOBS, ANNOUNCE and SCHOOLS lists at
>> http://mail.ale.org/mailman/listinfo
>>
>
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
>
>


-- 
-- 
James P. Kinney III
I would rather stumble along in freedom than walk effortlessly in chains.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.ale.org/pipermail/ale/attachments/20100922/679a2b95/attachment.html 


More information about the Ale mailing list