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

使用:

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

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

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

使用:

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

 

参考:

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

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

相关文章:

  • 2022-12-23
  • 2021-08-02
  • 2022-02-08
  • 2022-12-23
  • 2022-01-13
  • 2022-02-10
  • 2021-11-10
猜你喜欢
  • 2022-02-04
  • 2021-05-17
  • 2021-11-27
  • 2021-11-28
  • 2021-12-28
  • 2022-01-20
相关资源
相似解决方案