如何判断一个文件是否在Perl的远程文件系统上? [英] How can I tell if a file is on a remote filesystem with Perl?

查看:144
本文介绍了如何判断一个文件是否在Perl的远程文件系统上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在shell脚本或者Perl中,是否有一种快速和肮脏的方式来通过编程来告诉路径是位于远程文件系统(nfs之类的)还是本地的?或者是唯一的方法来解析/ etc / fstab并检查文件系统类型?

解决方案

stat -f -c%T< filename> 应该做你想做的事情。您可能还需要 -l <​​/ code>


Is there a quick-and-dirty way to tell programmatically, in shell script or in Perl, whether a path is located on a remote filesystem (nfs or the like) or a local one? Or is the only way to do this to parse /etc/fstab and check the filesystem type?

解决方案

stat -f -c %T <filename> should do what you want. You might also want -l

这篇关于如何判断一个文件是否在Perl的远程文件系统上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆