Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
when i drop a directory i want this directory listed? how can i do that. thx...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie
    Join Date
    Mar 2003
    Location
    Istanbul/Türkiye
    Posts
    246

    automatically list


    when i drop a directory i want this directory listed?
    how can i do that.
    thx
    Just a Newbie....Looking 4 Info....

  2. #2
    Linux Engineer
    Join Date
    Jan 2003
    Location
    Lebanon, pa
    Posts
    994
    alias cd="cd $1; ls"

    Probaby want to put that line in your .bashrc file.

  3. #3
    Linux Newbie
    Join Date
    Mar 2003
    Location
    Istanbul/Türkiye
    Posts
    246
    Thanks alot.
    Exactly i ll do.
    Just a Newbie....Looking 4 Info....

  4. #4
    Linux Newbie
    Join Date
    Mar 2003
    Location
    Istanbul/Türkiye
    Posts
    246
    Ooops that just list the directory doesnt drop it !
    It seems ok but why it doesnt work?,
    for example when i am in
    /root
    and i want to drop and list the directory
    /linux which is under /root it just list the directory /root/linux and stay in /root ??
    Just a Newbie....Looking 4 Info....

  5. #5
    Linux Engineer
    Join Date
    Apr 2003
    Location
    Sweden
    Posts
    796
    What do you mean with drop?? Do you want to remove a directory you use

    Code:
    rmdir or rm -rf <dirname>
    To list a directory you execute

    Code:
    ls -l <dirname>
    Do you want to list and remove directorys in a program/script?? A little more info please.
    Regards

    Andutt

  6. #6
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    Try this instead:
    Code:
    function cd &#40;&#41; &#123; command cd $1; ls; &#125;

  7. #7
    Linux Newbie
    Join Date
    Mar 2003
    Location
    Istanbul/Türkiye
    Posts
    246
    Quote Originally Posted by andutt
    What do you mean with drop?? Do you want to remove a directory you use

    Code:
    rmdir or rm -rf <dirname>
    To list a directory you execute

    Code:
    ls -l <dirname>
    Do you want to list and remove directorys in a program/script?? A little more info please.
    with drop i mean "get in" like

    cd directory-name
    ls directory-name

    i want an alias for this..
    thx all of you and Dolda i ll try your suggestion.
    Just a Newbie....Looking 4 Info....

  8. #8
    Linux Newbie
    Join Date
    Mar 2003
    Location
    Istanbul/Türkiye
    Posts
    246
    thx Dolda your suggestion worked properly except ls' color function so i added ls --color=always....

    but why the other aliases didnt work?
    Just a Newbie....Looking 4 Info....

  9. #9
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    That is because aliases can't take parameters; they are like macro expansions. Therefore, if you run the following:
    Code:
    alias cd="cd $1; ls"
    cd testdir
    That would be the same as running this:
    Code:
    cd ; ls testdir
    (That is because in the current shell, $1 is the empty string, and testdir as just inserted after "cd $1; ls").

  10. #10
    Linux Newbie
    Join Date
    Mar 2003
    Location
    Istanbul/Türkiye
    Posts
    246
    Got it. Thx Dolda and everyone who replied my question.
    I have to study too much
    Just a Newbie....Looking 4 Info....

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •