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'm trying to do cp -iu *.[ch] ../../mud/src/ to move all *.h and *.c files to another directory, but only overwrite those that are older than my current directory (thus the use of u). But it doesn't seem to work.
In my current dir:
2007-07-07 11:36 makeobjs.c
In the dir I will copy it to:
2007-07-07 11:40 ../../mud/src/makeobjs.c
That one is newer. Therefor, it shouldn't copy it.
So I went ahead and did cp -iu makeobjs.c ../../mud/src/
But it gave me:
cp: overwrite `../../mud/src/makeobjs.c'?
Am I doing something wrong? It shouldn't be overwriting the file.
I mean that using the -i option the shell prompt you with the question "overwrite...?" but even if you answer yes, the -u option avoids the copying if the source file is older than the target file (as you expected). In other words a newer file is never overwritten if you use the -u option, even if the shell make you believe that it is going to do that! ;-)
If you use "cp -u *.h *.c ../../mud/src/", only files with newer timestamps will be copied. You could see which files are copied with "cp -ul *.h *.c ../../mud/src/".
You will not be prompted at all.
I should correct my previous post however. The < <(! part will work if you want to respond no. But not for the right reason. Use < <(yes n) if you want to reply no and < <(yes y) if you want to reply yes. You need to do this in place of the --reply= option which is being removed from the cp and mv commands.