Eric Anderson
Eric Anderson

Reputation: 366

setting variables

hello I am trying to set two files to variables, does anyone know how I would do this? This code finds duplicate file names and then prints them if they are the same. But I need to be able to delete them and get the pathname. Thanks

find -type f -exec md5sum '{}' ';' | sort | uniq --all-repeated=separate -w 33 | cut -c 35-

So basically I have this md5sum | filename in a file. I am reading and finding the duplicates based on the md5sum. However I may also want to delete the duplicate and print the filepath. Any suggstions?

Upvotes: 0

Views: 63

Answers (2)

bmargulies
bmargulies

Reputation: 100013

I'm not quite clear, but I think you want to use a read loop:

ComplexFindCommand | while read PATHNAME ; do
    echo "This pathname is $PATHNAME"
done

Upvotes: 0

chown
chown

Reputation: 52738

Just assign to a variable, nothing special needed:

$ X="myFile.py"
$ echo $X
myFile.py

Upvotes: 1

Related Questions