I am trying to use two variables in another command. For example,
var1=$(ls | grep "foo")
var2=$(ls | grep "bar")
common=$(comm -1 -2 <($var1) <($var2))
echo "$common"
This is not working. When I write the entire thing in a single line it works.
Edit: I want to grep two file lists and then print only the common ones. But I still want the variables to be there since they are used in multiple places below.
comm?