简体   繁体   English

使用bash shell脚本锁定文件区域

[英]file region locking using bash shell script

I am trying write some script with which i can try to lock a region of file using bash shell script. 我正在尝试编写一些脚本,通过这些脚本,我可以尝试使用bash shell脚本锁定文件区域。

I have used flock, but it locks the whole file and does not provide parameters to lock a region of a file like in C language you get with fcntl. 我使用过flock,但是它会锁定整个文件,并且不提供参数来锁定文件区域,例如使用fcntl所获得的C语言。

Will be helpful someone can provide some suggestions in this area? 有人可以在这方面提供一些建议会有所帮助吗?

As you use flock (1) (which is a C program, see http://util-linux.sourcearchive.com/documentation/2.17/flock_8c-source.html ) to utilize flock (2), you would need a similar command that utilizes fcntl. 当您使用flock(1)(这是C程序,请参阅http://util-linux.sourcearchive.com/documentation/2.17/flock_8c-source.html )来利用flock(2)时,您将需要类似的命令利用fcntl。 If such a command doesn't exist yet, one would have to write it. 如果尚不存在这样的命令,则必须编写该命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM