linux - Shell comm parameters issue -


i have issue running shell script parameters. command running directly on linux works:

comm -13 <(sort /tmp/f1.txt) <(sort /tmp/f2.txt) > /tmp/f3.txt 

if trying run shell script command sending parameters , getting error below:

test.sh: line 6: syntax error near unexpected token `(' 'est.sh: line 6: `comm -13 <(sort $1) <(sort $2) > $3 

here shell code:

#!/bin/bash comm -13 <(sort $1) <(sort $2) > $3 

i run following command:

sh test.sh /tmp/f1.txt /tmp/f2.txt /tmp/f3.txt 

i have ran out of ideas might wrong. please assist.

thank you, -andrey

solutions:

  1. since have specified bash in script's shebang, why call sh? run ./test.sh /tmp/f1.txt /tmp/f2.txt /tmp/f3.txt

  2. use bash explicitly: bash test.sh /tmp/f1.txt /tmp/f2.txt /tmp/f3.txt


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -