将文件名从Nautilus传递到Shell脚本 [英] Pass filename from Nautilus to shell script

查看:57
本文介绍了将文件名从Nautilus传递到Shell脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试执行一个为参数获取文件名的shell脚本.

I am trying to execute a shell script that gets for an argument a file name.

如果我去终端并输入完整的PATH,我可以做到.

I can do it if I go to the terminal and type the full PATH.

但是我试图使它更加用户友好,所以我想做的是从文件管理器或nautilus发送参数(完整路径).

But I am trying to make this more user friendly so I what I want to do is to send the argument (complete path) from the file manager or nautilus.

有可能吗?

推荐答案

好吧,我将分享一种我认为可行的方法.

Ok I am going to share a way I found that works.

我要做的就是将路径作为参数传递,而不在命令行中键入.使其变得用户友好.

All I was trying to do was to pass a path as an argument, without typing it on the command line. to make it user friendly.

因此,我使用Zenity工具(文件选择)浏览文件管理器并选择文件.

So I use a zenity tool, file selection, to browse through the file manager and select the file.

./script.sh $(zenity --file-selection)

看,现在我正在传递所选文件的路径.

See, now I am passing the path of the file I selected.

如果您想尝试一下,只需在命令行中输入即可.

If you want to try this out, just type in the command line.

zenity --file-selection

这篇关于将文件名从Nautilus传递到Shell脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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