Suppose do you want test if /mnt/disk is a mount point in a shell script. How do you do this?
相关问题
- How to get the return code of a shell script in lu
- JQ: Select when attribute value exists in a bash a
- Invoking Mirth Connect CLI with Powershell script
- Why should we check WIFEXITED after wait in order
- Emacs shell: save commit message
相关文章
- 使用2台跳板机的情况下如何使用scp传文件
- In IntelliJ IDEA, how can I create a key binding t
- Check if directory exists on remote machine with s
- shell中反引号 `` 赋值变量问题
- How get the time in milliseconds in FreeBSD?
- Making new files automatically executable?
- Reverse four length of letters with sed in unix
- Launch interactive SSH bash session from PHP
This will set
$?
upon completion.EDIT: Used Bombe's idea to use cut.
Not relying on
mount
,/etc/mtab
,/proc/mounts
, etc.:When
$dir
is a mount point, it has a different device number than its parent directory.The benefit over the alternatives listed so far is that you don't have to parse anything, and it does the right thing if
dir=/some//path/../with///extra/components
.The downside is that it doesn't mark
/
as a mountpoint. Well, that's easy enough to special-case, but still.