Re: [SLE] Command-line puzzle

From: Anders Johansson (andjoh_at_rydsbo.net)
Date: 03/11/05

  • Next message: Leendert Meyer: "Re: [SLE] Command-line puzzle"
    To: suse-linux-e@suse.com
    Date: Fri, 11 Mar 2005 00:45:09 +0100
    
    

    On Friday 11 March 2005 00:31, Paul W. Abrahams wrote:
    > Here's a little command-line puzzle. Suppose you want to move all files
    > from directory A to directory B. You might think that
    >
    > mv A/* B
    >
    > would do it. But no -- that doesn't move the dotfiles. So how about
    >
    > mv A/* A/.* B
    >
    > No -- that tries to move "." and "..". So how about
    > mv A/* A/.?* B
    >
    > That still tries to move "..", but not ".". Finally, how about
    >
    > mv A/* A/.[^.]* B
    >
    > That actually does it, I think -- but it's very inelegant. Does anyone
    > have an elegant solution (that works for other commands also)?

    shopt -s dotglob
    mv A/* B/

    Have a look at "man bash" for a description of shopt, dotglob and the other
    possibilities available

    -- 
    Check the headers for your unsubscription address
    For additional commands send e-mail to suse-linux-e-help@suse.com
    Also check the archives at http://lists.suse.com
    Please read the FAQs: suse-linux-e-faq@suse.com
    

  • Next message: Leendert Meyer: "Re: [SLE] Command-line puzzle"

    Relevant Pages

    • Re: [SLE] Command-line puzzle
      ... On Thu, 2005-03-10 at 18:31, Paul W. Abrahams wrote: ... > Here's a little command-line puzzle. ... If on different mounted filesystems: ... For additional commands send e-mail to suse-linux-e-help@suse.com ...
      (SuSE)
    • Re: [SLE] Command-line puzzle
      ... > Here's a little command-line puzzle. ... > have an elegant solution? ... However mv will bark if there is no dot-file. ... For additional commands send e-mail to suse-linux-e-help@suse.com ...
      (SuSE)
    • [SLE] Command-line puzzle
      ... Here's a little command-line puzzle. ... For additional commands send e-mail to suse-linux-e-help@suse.com ... Also check the archives at http://lists.suse.com ... Please read the FAQs: suse-linux-e-faq@suse.com ...
      (SuSE)