Skip to content

Instantly share code, notes, and snippets.

@dmthuc
Created March 9, 2018 03:52
Show Gist options
  • Select an option

  • Save dmthuc/1dc97e98735e20467c7cf7494916ae80 to your computer and use it in GitHub Desktop.

Select an option

Save dmthuc/1dc97e98735e20467c7cf7494916ae80 to your computer and use it in GitHub Desktop.
Shell script to add UTF-8 BOM to any file
#!/bin/bash
file=$1
cat $file > $file".temp"
printf "\xEF\xBB\xBF" > $file
cat $file".temp" >> $file
rm $file".temp"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment