Linux command-line: libreoffice --convert-to odt:writer8 myfile.txt
The returned status code ($?) is zero. So far, so good. But, when I try to access the newly-created ODT file (E.g. copy it), it doesn’t yet exist.
Adding sync; sync; sync right after the libreoffice batch execution did not help.
Adding --headless as an option did not help.
However, if I sleep for a few seconds immediately after the libreoffice batch execution, then the file finally gets completed before a subsequent command references the ODT file.
Sample script:
cp   /etc/fstab   myfile.txt
libreoffice   --headless   --convert-to   odt:writer8   myfile.txt
RC=$?
if [ $RC -ne 0 ]; then
    echo '*** libreoffice conversion failed for myfile.txt'
    exit 86
fi
#sleep 3
ls *.odt
Result: ls: cannot access ‘*.odt’: No such file or directory
If one changes the above script so that the sleep is actually executed, then the ODT file is available.
Observation: It appears that executing libreoffice in batch mode is somehow kicking off a separate process to finish the ODT file.
Expected result: The exit to the shell and the availability of the ODT file should be synchronized.
Environment: Xubuntu 18.04, x64, up-to-date
