Linux.com

File conversion script destroys file permissions

Posted by: Anonymous Coward on November 04, 2004 07:25 AM
The file conversion script in the article has a serious bug, it destroys the file's permissions.

The given script:

iconv -f old-encoding -t UTF-8 filename > temp.tmp && mv temp.tmp filename

Should be written:

iconv -f old-encoding -t UTF-8 filename > temp.$$ && cat temp.$$ > filename && rm temp.$$

These changes also allow concurrent jobs to run in parallel.

Karl O. Pinc kop@meme.com

#

Return to Using Unicode in Linux