I have two directories named comp1 and comp2 and both have files named file1 and file2.I need a bash script which read file1 from both the directories and take diff of each file and redirect to some other file. For example.diff comp1/file1 comp2/file1 > file1.diff
Read files in Directory and take diff
linux;bash;diff
#!/bin/shfor f in comp1/* ; do  diff comp1/$f comp2/$f > $f.diffdoneThis script assumes you have files of the same name in both directories.