alias cd

alias cd

Post by A_Rio » Sun, 21 May 2000 04:00:00



What would be the proper way to alias cd so that you not only change
directories but you get an ls -F as well?  It is rare that I cd without ls
being the next command.
Thanks

 
 
 

alias cd

Post by alex » Sun, 21 May 2000 04:00:00


probably the right thing is to have a shellfunction for it.
but i tried with aliases and met some strange things.

alias cl='cd $1;ls -F'

i didn't know if $1 works with aliases as with functions.
still don't know:)

[user /path]$ cl newdir

...listed the new dir, but strangely didn't cd there.

alias eko='echo $1'
eko blabla actually echoes blabla.

but why doesn't cl cd?


> What would be the proper way to alias cd so that you not only change
> directories but you get an ls -F as well?  It is rare that I cd without ls
> being the next command.
> Thanks

--

.
.
... ak42 at kurir dot net ...

 
 
 

alias cd

Post by Christoph Lang » Tue, 23 May 2000 04:00:00





>> #
>> # What would be the proper way to alias cd so that you not only change
>> # directories but you get an ls -F as well?  It is rare that I cd without ls
>> # being the next command.
>> # Thanks
> with my zsh this works since I've set zsh up;-)
> cd() {
>         builtin cd $1; ls
> }

It works not only with zsh, but also with bash and ksh.

Christoph

--
God is real, unless declared integer
Christoph Lange

 
 
 

alias cd

Post by Fredrik Granlu » Wed, 24 May 2000 04:00:00




Quote:> Thanks, that works nicely.
> Any chance of getting an explanation as to why it works?
> Thanks

from the manpage:

  csh
     alias [ name [ def ] ]

  csh
     alias assigns def to the alias name.  def is a list of words
     that  may  contain  escaped history-substitution metasyntax.
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

///Fredrik

 
 
 

alias cd

Post by Marshal Bento » Fri, 26 May 2000 04:00:00


alias cdl 'cd \!*;ls

-marshal-


>==>Date: Sat, 20 May 2000 16:18:58 GMT

>==>Newsgroups: comp.unix.shell
>==>Subject: Re: alias cd
>==>
>==>Sorry I neglected to mention this is using tcsh.
>==>Any help is appreciated.
>==>

>==>>probably the right thing is to have a shellfunction for it.
>==>>but i tried with aliases and met some strange things.
>==>>
>==>>alias cl='cd $1;ls -F'
>==>>
>==>>i didn't know if $1 works with aliases as with functions.
>==>>still don't know:)
>==>>
>==>>[user /path]$ cl newdir
>==>>
>==>>...listed the new dir, but strangely didn't cd there.
>==>>
>==>>alias eko='echo $1'
>==>>eko blabla actually echoes blabla.
>==>>
>==>>but why doesn't cl cd?
>==>>

>==>>>
>==>>> What would be the proper way to alias cd so that you not only change
>==>>> directories but you get an ls -F as well?  It is rare that I cd without
>==>ls
>==>>> being the next command.
>==>>> Thanks
>==>>
>==>>--
>==>>
>==>>.
>==>>.
>==>>... ak42 at kurir dot net ...
>==>
>==>
>==>

 
 
 

1. alias cd to do ls after every cd

i have a quick question:

is there a way i can alias the "cd" command to do an ls every time i do
a "cd" ?

i guess this has something to do with backticks. simply doing alias cd
`cd; ls` isn't working (obviously because i have to "pass in" the
directory i type after cd into the backticked cd command and then do
ls)

any tips?

Mahurshi Akilla

2. too many files open

3. aliased cd in ksh not recognising some directories

4. linux router, email server, web server, newbie

5. aliasing cd in csh

6. Compiling Problem!

7. aliases, aliases, aliases...

8. Creating a custom boot disk for thinkpads?

9. script alias problem - Re: apache alias and script alias problem

10. want alias so that cd will not echo

11. an alias for cd to set PS1=pwd

12. alias -x back='cd $OLDPWD'

13. trying to cd in an alias or script