LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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!

Notices


Closed Thread
  Search this Thread
Old 05-25-2020, 04:50 PM   #1
BringMara
LQ Newbie
 
Registered: May 2020
Posts: 5

Rep: Reputation: Disabled
Exclamation Shell script copy files to another path


I have to make a shell script which compares 2 files line by line and finds different lines.If the number of the different lines is greater than 20,then I have to copy the 2 files to another path and then archive and delete the files.Dir1 and dir2 are the 2 files.What I came up with is:
#!/bin/bash
If [ “$(diff dir1 dir2 |wc -l)” -gt “20” ] then
I know I need the cp command but I don’t know how to write it exactly.I alsoo need tar for archives and rm $file to delete
 
Old 05-25-2020, 05:01 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 23,412

Rep: Reputation: 6644Reputation: 6644Reputation: 6644Reputation: 6644Reputation: 6644Reputation: 6644Reputation: 6644Reputation: 6644Reputation: 6644Reputation: 6644Reputation: 6644
Duplicate of other homework thread. Reported
 
1 members found this post helpful.
Old 05-25-2020, 05:26 PM   #3
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,148
Blog Entries: 13

Rep: Reputation: 4221Reputation: 4221Reputation: 4221Reputation: 4221Reputation: 4221Reputation: 4221Reputation: 4221Reputation: 4221Reputation: 4221Reputation: 4221Reputation: 4221
@BringMara,

This thread is being closed because it is a duplicate.

This is your second duplicate several hours after an earlier one was closed.

Please refrain from continuing to create duplicate threads.
 
  


Closed Thread

Tags
new linux user, shell script


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] I go to example: azprovider.com another path www.azprovider.com going to another path DeSouffle Linux - Networking 5 09-03-2013 03:13 PM
Want to change how pasted files are named "(copy)," "(another copy)," "(3rd copy)" L a r r y Linux - Desktop 3 08-24-2013 04:39 PM
[SOLVED] How to move or copy files present between two dates to another path folder. ankitpandey Linux - General 22 02-06-2012 02:21 AM
[SOLVED] run a shelll script from another shell script in another directory raulab Linux - Newbie 12 02-22-2011 06:18 PM
Call One shell script from another shell script Sundaram Linux - Software 5 10-13-2006 04:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration