bin sh script - “(” unexpected [duplicate]

人盡茶涼 提交于 2019-12-11 10:52:58

问题


What is wrong with this script?

#!/bin/sh

for file in *.p; do awk -f get_p.awk "$file" > "$file"er; done 

awk -f phase-comp.awk file1 file.per # výpočet fází
paste <(awk '{print $1}' output1) <(awk '{print $2}' file1) > out

The error is:

5: skript: Syntax error: "(" unexpected

When I write command separately to terminal. It works well. Thank you


回答1:


The problem is your shebang:

#!/bin/sh

It means this script is meant to be interpreted by sh, but your script uses process substitution which is a bash-specific feature. So, you should change it to:

#!/bin/bash

to make your script work.



来源:https://stackoverflow.com/questions/55884031/bin-sh-script-unexpected

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!