Re: [SLE] Command-line puzzle
From: Anders Johansson (andjoh_at_rydsbo.net)
Date: 03/11/05
- Previous message: Randall R Schulz: "Re: [SLE] Command-line puzzle"
- In reply to: Paul W. Abrahams: "[SLE] Command-line puzzle"
- Next in thread: Paul W. Abrahams: "Re: [SLE] Command-line puzzle"
- Reply: Paul W. Abrahams: "Re: [SLE] Command-line puzzle"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: Randall R Schulz: "Re: [SLE] Command-line puzzle"
- In reply to: Paul W. Abrahams: "[SLE] Command-line puzzle"
- Next in thread: Paul W. Abrahams: "Re: [SLE] Command-line puzzle"
- Reply: Paul W. Abrahams: "Re: [SLE] Command-line puzzle"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|