I have a program called prg.exe written in C#. I want to run this program in mono with an argument (arg1) and redirect the output to a log file called log.txt.
If I open a terminal and enter the command:
mono --debug prg.exe arg1 > log.txt
everything works fine.
When the program is finished, the log.txt file is created, which contains any error.
Now I want to create a desktop entry called prg.desktop:
[Desktop Entry]
Name=My prg
Comment=some comment
Icon=/usr/share/pixmaps/openbox.xpm
Exec=mono --debug prg.exe arg1 > log.txt
Type=Application
Encoding=UTF-8
Terminal=false
Categories=None;
If I run prg.desktop, the log.txt file is not created.
What do I need to do to create the log file?
Thank you very much.
I foud the answer here: https://askubuntu.com/questions/1339075/how-to-redirect-the-output-from-desktop-entry
Exec=sh -c "mono --debug prg.exe arg1 > log.txt"