Shell script project Asap
Hi,I need to make a shell script that copies to a separate Path only the files in which the user modified more than 20 lines at a certain time/date.Files are archived and then deleted.
|
ok, and what is your problem? Where did you stuck?
|
Not enough info. Are the files kept in a VCS?
|
While the filesystem keeps the time of last modification, it's only possible to know the modified lines if the original file is kept. Also, if the file is modified today and again tomorrow, today's modification date is forgotten.
In other words, your requirement can't be fulfilled without a very special filesystem type, and/or a special application with which the files are altered. |
Quote:
2. So if 19 lines were modified it two days ago and 1 line today it would be rejected? Because 20 lines weren't modified today? 3. You copy files to a specified path and then you archive them and then you delete them. Seems a bit odd. Puzzled??? |
Quote:
And if you get STUCK, you need to post what YOU have written/done/tried, give us examples of what you're using for input, what you want as output, and where things are failing, and we will be glad to assist you from there. But we are not the place for 'need my homework done ASAP' |
I am really struggling with a homework.I have to make a shell script that will copy to a separate path the files in which the user modified more than 20 lines on a specific date.The files should also be archived and them deleted.
What I know right now: To copy a file somewhere else i use this: $ ls dir1/ dir2/ $ cp -r dir1/ dir1.copy $ ls dir1.copy dir2/ To show number of lines in a file and modified files in the last days: wc -l file1 mtime or find ~/Desktop -type f -newermt 2020-05-22 -ls for example I use tar for archives and rm to remove.The problem is I have very little experience with linux and I don’t know how to form the final shell script. |
Quote:
It provides some good overview of bash programming, how to start and how to debug. |
Check out this link: https://bash.cyberciti.biz/guide/Hello,_World!_Tutorial
Or open Google.com and search for this keyword: "how to create a shell script in linux" Or this keyword: "linux bash hello world tutorial" Example: Quote:
Good luck!!! |
All times are GMT -5. The time now is 06:44 AM. |