Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我lockfile用来确保一段代码一次只能运行一个。
lockfile
如果我想允许一次运行 n 个相同代码的副本,该怎么做?谢谢。
if lockfile -1 lockfile.txt then # something rm -f lockfile.txt else echo error exit fi
gnu sem 看起来是一个可行的选择:https ://www.gnu.org/software/parallel/sem.html