Bash supports file discriptor assignment in this way. So remove the hard
coded numbers. Also close this opened fd in cleanup.
Signed-off-by: Murphy Zhou <xzhou@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
_cleanup()
{
+ exec {test_fd}<&-
cd /
rm -f $tmp.*
}
echo inode $tf_inode >> $seqres.full
# Create new fd by exec
-exec 9> $testfile
+exec {test_fd}> $testfile
# flock locks the fd then exits, we should see the lock info even the owner is dead
-flock -x 9
+flock -x $test_fd
cat /proc/locks >> $seqres.full
# Checking