
我正在嘗試在 bash 中(第一次)為 Deluge 插件執行編寫腳本,以便在下載完成後它將更改下載的 torrent 的權限。
它是:
#!bin/bash
torrentpath=$3
sudo chmod -R 777 $torrentpath
也嘗試在“”中使用 $torrentpath,也不起作用。從外掛程式 wiki 頁面複製前兩行(https://dev.deluge-torrent.org/wiki/Plugins/Execute)。
知道如何讓它發揮作用嗎?
答案1
雙引號你的變數...你真的需要 sudo 嗎?
#!bin/bash
sudo chmod -R 777 "$3"
答案2
你的 shebang 行是錯誤的,除非bin
是在 cwd 中。
更改#!bin/bash
為#!/bin/bash
,這應該可以修復它。