脚本中的语法错误,但不是单个命令

时间:2018-09-05 13:44:40

标签: shell comm

我有一个脚本可以在shell中的每一行中正常工作,但是当我将其作为脚本运行时,我在比较2个文件并将第三个差异中吐出差异的那一行上出现语法错误。

#! /bin/sh
#Dump all lines for line deletion
mysql -e "select SOMECOLUMN from SOMETABLE where SOMECOLUMN like \"%SOME MATCH%\"" -u USERNAME -pPASSWORD DATABASE > 00_all_removed_lines.txt
#Delete first line which is the header
sed '1d' 00_all_removed_lines.txt > 01_all_removed_lines_without_header.txt
#Pull data with : as delimiter and print with ,
awk -F: '{printf "%s,%s\n",$NF,$(NF-1)}' 01_all_removed_lines_without_header.txt > 02_all_removed_lines_just_data.txt
#Delete blank spaces and extra text
sed -e s/"- SOME TEXT"//g -i 02_all_removed_lines_just_data.txt
sed -e s/" "//g -i 02_all_removed_lines_just_data.txt
#Compare result to HISTORY file and produce differences
comm -23 <(sort 02_all_removed_lines_just_data.txt) <(sort 04_all_removed_lines_history.txt) > 03_all_removed_lines_differences.txt
#Copy result for comparison later in HISTORY file
cat 03_all_removed_lines_differences.txt >> 04_all_removed_lines_history.txt

这是语法错误:

./MYSCRIPT.sh: line 12: syntax error near unexpected token `('
./MYSCRIPT.sh: line 12: `comm -23 <(sort 02_all_removed_lines_just_data.txt) <(sort 04_all_removed_lines_history.txt) > 03_all_removed_lines_differences.txt'

我到底会忘记什么?预先感谢您提供任何提示。

0 个答案:

没有答案