Bash shell read error: 0: Resource temporarily unavailable

后端 未结 6 2059
感情败类
感情败类 2021-02-07 23:54

When writing a bash script. Sometimes you are running a command which opens up another program such as npm, composer.. etc. But at the same time you need to use read

6条回答
  •  梦如初夏
    2021-02-08 00:28

    I had the same problem. I solved by reading directly from tty like this, redirecting stdin:

    read -p "Play both [y]? " -n 1 -r 

    instead of simply:

    read -p "Play both [y]? " -n 1 -r
    

    In my case, the use of exec 3<&0 ... didn't work.

提交回复
热议问题