Implementing infinite wait in shell scripting

前端 未结 7 557
独厮守ぢ
独厮守ぢ 2021-02-05 04:30

This may sound trivial, but I\'m pretty sure this question hasn\'t been asked, or at least I can\'t find it.

I\'m looking for a way to construct an infinite wait

7条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-05 05:14

    What's wrong with your 2nd option but forcing it to read from stdin ? (Requires bash)

    while true; do
      read
    done < /dev/stdin
    

    From man bash

    Bash handles several filenames specially when they are used in redirections, as described in the following table:

              /dev/stdin
                     File descriptor 0 is duplicated.
    

提交回复
热议问题