I need to compare the contents of a file located in dir A with actual files in different directory. ex- directory A has a file test.txt , Item mentioned in test.txt and not present in directory B should be highlighted. im doing something like this but not working.. it is only searching last word from the file test.txt
#!/bin/sh
IFS=$'\n' dirA=$1 dirB=$2
for x in $(cat < "$1"); do base_name="${x##/}"
set -- "$dirB"/"$base_name"*
if [ -e "$1" ]; then
for y; do
echo "$base_name found in B as ${y##*/}" done
else
echo "$x not found in B" fi done.
bash
, and that the code does not include anything that is specific to that shell. – Kusalananda Apr 11 '19 at 10:03