-   Linux - Newbie (
-   -   Syntax Error while using CMP function (

dsfreddie 08-15-2012 04:11 PM

Syntax Error while using CMP function
Hi All,

I am getting a syntax error message while trying to compare 2 files using the compare function (LINUX)


cmp -s <(tr , \\n < $COMMON_TMP/nt_per_gs.done | sort) <(tr , \\n < $COMMON_TMP/nt_per_chg_indx.done | sort)
Syntax Error Message


command substitution: line 79: syntax error near unexpected token `('
command substitution: line 79: `cmp -s <(tr , \n < $COMMON_TMP/nt_per_gs.done | sort) <(tr , \n < $COMMON_TMP/nt_per_chg_indx.done | sort)'
+ file_cmp_chk=1
The return value should be 0 as both the .done file contain the same dates. (like below)


$ cat /iis_dev_data3/wcc/cpmg/tmp/wcc_cpmg_nt_per_chg_indx.done

$cat /iis_dev_data3/wcc/cpmg/tmp/wcc_cpmg_nt_per_gs.done
Can you pls help to fix this issue


werewolfy 08-15-2012 04:37 PM

Didn't try it, just a quick shot:

Try putting a $ directly in front of both opening braces to make them an executable subcommand.

And are there really no spaces after the input redirection characters "<"?

Try additionally putting one there each (i.e. in front of the newly added "$" ), if the above does not help - the shell can be picky about whitespace.
Funny enough, you put spaces around the commas inside the brackets, which should be unncessary - but better too many than too few, if in doubt ;o)

All times are GMT -5. The time now is 05:29 AM.