Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I am trying to copy a set of files which I want to select with find.
A simplified example would be:
for i in `find . -mtime 5`; do cp $i /dest/; done
The problem is that some of the files i select contain spaces. Such a filename is interpreted by the for command as separate words, and the resuls are that cp gets only parts of the filename at a time.
How can I solve this best ?
My first ideas were to redefine $IFS to only include newlines, but this may result in problems later on (in reality i do more complex things between do and done).
The next idea was to somehow format the output of find so that each filename would be quoted "my filename", but I think the shell would interprete these quotes as \"my filename\" .
The best thing would be if I could make find return my\ filename, but I don't know how to do that. Any ideas ?
Excellent! You just showed me how to "correct" the two shortcommings I thought were in xargs (and were not in fact): XX is for being able to append args to the stdin args, isn't it? And print0 and -0 are for separating args by nul instead of blank (à-la C), right?