
Ich habe ein Nautilus Action
Skript erstellt, um die Dateikodierung mithilfe recode
einer Anwendung zu ändern.
Meine Aktion ist:
[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
Der Code funktionierte eine Zeit lang einwandfrei, aber jetzt schlägt er fehl!
Wenn ich Aktionen einstelle, wird Folgendes angezeigt 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
die Datei kann nicht gefunden werden, obwohl sie da ist! (Wenn ich den gleichen Befehl in einem Terminalfenster ausführe, funktioniert es)
Was ist das Problem?
Warum sh
kann die Datei nicht gefunden werden?
Danke
Antwort1
Das Problem waren Anführungszeichen im Befehl!
Die Verwendung recode windows-1256 %F
von anstelle von recode windows-1256 "%F"
hat das Problem gelöst!