Ubuntu 16.04下在Shell终端下使用nautilus快速打开窗口文件夹

Ubunut 16.04默认使用nautilus进行管理资源文件夹,nautilus默认是支持参数传递的。

使用:

nautilus /dirurl

打开当前文件夹(可以使用$PWD代替):

nautilus "$(pwd)"

封装:

#新建文件
sudo
vim /usr/bin/opendir
#写入如下内容
nautilus "$(pwd)"
>/dev/null 2>&1
#修改权限
sudo chmod +x /usr/bin/opendir

使用:

再升级一下,支持参数传递:

if [ -n "$1" ]; then
        nautilus "$1" >/dev/null 2>&1
else
        nautilus "$(pwd)" >/dev/null 2>&1
fi

使用:

参考:

http://caogaoyang.blog.163.com/blog/static/422173012011111705743103/

http://www.jb51.net/article/34332.htm(Shell脚本if else知识)

原文地址:https://www.cnblogs.com/EasonJim/p/7877896.html