
我創建了一個Nautilus Action
腳本來使用recode
應用程式更改文件編碼。
我的行動是:
[Desktop Entry]
Type=Action
ToolbarLabel[en_US]=Convert Encoding From Windows-12
ToolbarLabel[en]=Convert Encoding From Windows-12
ToolbarLabel[C]=Convert Encoding From Windows-12
Tooltip[en_US]=Converts file content encoding from Windows-1256 and saves as UTF-8
Tooltip[en]=Converts file content encoding from Windows-1256 and saves as UTF-8
Tooltip[C]=Converts file content encoding from Windows-1256 and saves as UTF-8
Name[en_US]=Convert Encoding From Windows-1256
Name[en]=Convert Encoding From Windows-1256
Name[C]=Convert Encoding From Windows-1256
Profiles=profile-zero;
[X-Action-Profile profile-zero]
SelectionCount==1
MimeTypes=all/allfiles;
Matchcase=false
Basenames=*.srt;
Exec=recode windows-1256 "%F"
Name[en_US]=Default profile
Name[en]=Default profile
Name[C]=Default profile
ExecutionMode=DisplayOutput
該代碼在一段時間內工作正常,但現在失敗了!
當我設定操作時ExecutionMode
,DisplayOutput
它會顯示以下內容:
Run command:
/bin/sh -c 'recode windows-1256 "'\''/home/ariyan/a.srt'\''"'
Standard output:
Standard error:
recode: fopen ('/home/ariyan/a.srt'): No such file or directory
當文件存在時它找不到它! (當我在終端機視窗中運行相同的命令時,它可以工作)
有什麼問題?
為什麼sh
找不到文件?
謝謝
答案1
問題出在命令中的引號!
使用recode windows-1256 %F
而不是recode windows-1256 "%F"
解決問題!