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:
since have specified
bash
in script'sshebang
, why callsh
? run./test.sh /tmp/f1.txt /tmp/f2.txt /tmp/f3.txt
use
bash
explicitly:bash test.sh /tmp/f1.txt /tmp/f2.txt /tmp/f3.txt
Comments
Post a Comment