Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Can someone explain to me what this line means? I get the redirection part at the end, but I didn't know you could pipe to cp like that. And what is the deal with the brackets. Regex? I know what the vars 'skel' and 'home' are but i can't tell what it's doing.
I think I sorta get it... the "n"s are piped to cp in order to skip past all conflicts that "-i" asks about. The thing between braces looks like a fancy way of copying all files that gets around bash's weird globbing of dotfiles.
The part between the braces is called brace expansion (a bash feature), which can generate strings. Brace expansion is performed before any other expansions and can be nested (which is true in your example).
This: {[^.],.[^.],..?} is seen by bash as 3 "expansions" (comma separated):
[^.] -> files starting with any normal character .[^.] -> files starting with a dot followed by any normal character ..? -> files starting with 2 dots and a single normal character
The * after the {..,..,..} command tells bash it is not limited to the first one (or two) characters mentioned the the brace expansion.
I'm not sure why the command fails with a broken pipe error, it works on my linux box. Are you trying this on a linux or an OS-X box?
BTW: The -R in the command shown isn't needed. The -a (which is short for -dpR) already takes care of it.
The pipe probably fails because the cp command fails. You may be able to find out more by running the cp command at the command prompt, replacing the variables with their known values. Alternatively it may help to echo ${skel}/{[^.],.[^.],..?}*, replacing $skel with the known value.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.