The diff command gives a list of details along with the difference of files/folders like this
dirs=`diff -aq new_dir/ old_dir`
gives:
Only in new_dir/: five Common subdirectories: new_dir/four and old_dir/four Common subdirectories: new_dir/one and old_dir/one
But I want only the folder/file name without the details that is: five,four and etc. That is without the details
I tried something like this:
dirs=diff -aq new_dir/ old_dir | grep 'Only in new_dir/: *'
I don't think this is the right way to get ONLY the difference of folders. Is there any better way to solve this?
My desired output:
five
seven
six
and Not
Only in new_dir/: five
Only in new_dir/: seven
Only in new_dir/: six
Commonin both? Or I am misunderstanding your question? Can you show your desired output? Also, do quote yourdirsvariable so that newlines are pressured.