创建一个接受拖放放可执行bash脚本;下降 [英] Create executable bash script that accepts drag & drop
问题描述
从Ubuntu的源代码编译我的mplayer。我不想使用GUI,但我想作一个可执行文件的bash从该被丢弃到bash的文件的文件中获取的路径。我怎么做出这样的事可能吗?
I compiled mplayer from source on Ubuntu. I didn't want to use a GUI but I wanted to make a executable bash file that gets the path from an file that gets dropped onto the bash file. How do I make such a thing possible?
我想使它看起来像这样: mplayer的<获得完整的文件路径
文件的结尾方式>
I wanted to make it look something like this:
mplayer <get full path to file
.file-ending>
我要的可执行文件的bash坐在我的桌面上;)
I want the executable bash file to sit on my desktop ;)
如果可能的话,我只是想一个单击鼠标右键 - &GT;为mplayer
函数开始,但我不知道怎么做的。
If possible, I'd just like an rightclick -> start with mplayer
function, but I don't know how to make one.
推荐答案
尝试:
#!/bin/bash
mplayer "$1"
被丢弃的文件的文件路径将被传递给脚本文件的第1命令行参数。
The file path of the dropped file will be passed to the script file as the 1th command line argument.
这篇关于创建一个接受拖放放可执行bash脚本;下降的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!