75
I have a variable $data and variable $file in a bash script:
data=$(echo "$(printf '%s\n' "${array[@]/%/$'\n\n'}")")
file=$(<scriptfile_results)
Those variables will contain text. How to compare those two? One option is to use diff(1) utility like this:
diff -u <(echo "$data") <(echo "$file")
Is this an correct and elegant way to compare content of two variables? In addition how is the <( ) technique called? As I understand, for each <( ) a temporary file(named pipe) is created..